How to update graphic output?

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

How to update graphic output?

Post by Guenter »

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: 291
Joined: Sun Apr 20, 2014 11:43 am
Location: Chichester, England
Contact:

Re: How to update graphic output?

Post by MrTAToad »

Easiest way would be to draw onto an image, which could then be continually displayed.
Post Reply