Just starting out? Need help? Post your questions and find answers here.
Guenter
 
Posts: 1
Joined: Tue Jul 11, 2017 12:18 pm

How to update graphic output?

by Guenter Tue Jul 11, 2017 12:29 pm

Hello,
i made a simple graphic programm and have to wait some seconds until the rendered graphic will be shown.
My Question: Is it possible to show an update of the graphic every time a single line is calculated?
Greetings
Gunter

Code: Select all
Dim cols(3,256)
Define.i c, x, y, r,g,b
pi.f = 3.141

ExamineDesktops()
x_size.i = DesktopWidth(0) - 100
y_size.i = DesktopHeight(0) - 100

For i=0 To 255
  cols(0,i) = Abs(128-127*Sin(i*pi/32))
  cols(1,i) = Abs(128-127*Sin(i*pi/64))
  cols(2,i) = Abs(128-127*Sin(i*pi/128))
Next

If OpenWindow(0, 0, 0, x_size, y_size, "Plasma Spiderbasic", #PB_Window_TitleBar)
  If CreateImage(0, x_size, y_size)
    If StartDrawing(ImageOutput(0))
      x2=Random(15)+20
      y2=Random(20)+8
      For y = 1 To y_size-1
        For x = 1 To x_size-1
          c = Int(0.5 + Sin(x/x2)*128 + Sin(y/y2)*32 + Sin((x+y)/16)*64) & 255
          r = Int(cols(0,c)) & 255
          g = Int(cols(1,c)) & 255
          b = Int(cols(2,c)) & 255   
          Plot(x, y, RGB(r, g, b))
        Next
      Next
      StopDrawing()
    EndIf
  EndIf
  ImageGadget(0, 0, 0, x_size, y_size, ImageID(0))
EndIf
User avatar
MrTAToad
 
Posts: 280
Joined: Sun Apr 20, 2014 11:43 am
Location: Chichester, England

Re: How to update graphic output?

by MrTAToad Thu Jul 13, 2017 9:21 am

Easiest way would be to draw onto an image, which could then be continually displayed.
Return to Coding Questions

Who is online

Users browsing this forum: No registered users and 1 guest