I want to rewrite an image every loop, and keep drawing it. It was easy to do it Blitz3D with imagebuffers but with pixmaps on my computer after like 5 seconds it starts leaving trails and flickering. I realize I am creating the image in the loop, I need a fresh image every frame. Am I doing something wrong?
Graphics 555,555
Local pixmap:TPixmap
Local image:timage
Repeat
image=CreateImage(111,111)
a:+2
x=50+Cos(a)*40
y=50+Sin(a)*40
pixmap=LockImage(image)
For f=1 To 10
WritePixel pixmap,x+f,y+f,$FF0000FF
Next
For f=1 To 10
WritePixel pixmap,x+Cos(a)*f,y+Sin(a)*f,$FFFF0000
Next
UnlockImage image
SetColor 255,255,255
DrawImage image,22,22
DrawPixmap pixmap,222,222
Flip
Cls
If KeyHit(key_escape) Then End
Forever
And if I comment out the DrawPixmap (I don't need it anyways) the same problem happens with drawimage just not as bad.
|