flickering in full screen
BlitzPlus Forums/BlitzPlus Programming/flickering in full screen
| ||
i have no clue why, but my fullscreen 2d mode suddenly went beserk or: the screen flickers really bad. if i run this is see a black and a white screen (with some red lines) really rapidly after each other (kinda epileptic).Graphics 640,480,32,0 SetBuffer(BackBuffer()) ClsColor(255,255,255) Cls Color(255,0,0) While Not KeyHit(1) Line(Rnd(640),Rnd(480),Rnd(640),Rnd(480)) Flip() Wend i did not upgrade my graphics drivers or change anything in my system and it used to work just fine. anybody any suggestions? thanks. |
| ||
You need to do Cls on both buffers.Cls : Flip : Cls Right now you are flipping between a white screen and a black one. |
| ||
well, that fixes the problem (sort of) in this case, but it still doesn't explain why it never did it before and why other applications (such as the atan2 example from the help or platypus from anthony flack) flicker as well. |
| ||
You aren't making any sense. The code you displayed SHOULD flash between black and white at a rate of your monitor refresh rate with random red lines drawn here and there. What did you expect? |
| ||
@koekjsbaby your code gives me a white screen progressively filled with red lines, and no flicker. Are you using Blitz Basic 2D or Blitz+ ? |
| ||
Ahh, if koekjesbaby was using BlitzPlus, the result could have been different. I recently read that in BlitzPlus, the BackBuffer is copied to the FrontBuffer (or vice versa, don't know which way) during a flip, so ONE CLS command would actually clear both buffers. |
| ||
Not sure about BlitzPlus, but with Blitz Basic and Blitz3D it can depend on whether you're in fullscreen or windowed mode. Fullscreen = 2 buffers that are flipped. Windowed = 1 buffer, where the back is copied to the front during a flip. I image that it's very similar in BlitzPlus, as per WolRon's reply. |
| ||
Clearing both buffers with the same background color should fix the intense black/white flicker. There is another problem with the sample code. It draws half the lines to each of the two buffers. Here is a version which does all drawing to the back buffer. Graphics 640,480,32,0 SetBuffer BackBuffer() ClsColor 255,255,255 Cls Color(255,0,0) While Not KeyHit(1) Line Rnd(640),Rnd(480),Rnd(640),Rnd(480) Flip CopyRect 0,0, 640, 480, 0,0, FrontBuffer(), BackBuffer() Wend There should be no flicker in any version of Blitz, fullscreen or windowed. Clearing both screens is no longer needed. The back buffer gets completely overwritten each time. |
| ||
i really appreciate your replies, but the code i pasted was just an example. my main problem is that any fullscreen blitzgame flickers (including my own) while they used to look fine. is it possible that my logitech itouch drivers (which i have uninstalled) messed things up? thanks. ps. floyd, your latest code works without flickering, thanks. |
| ||
can't see how keyboard drivers would affect your display... hows it going, shed any light on the problem? and you didn't say which version of Blitz you were using ? |
| ||
can't see how keyboard drivers would affect your display... well, it's one of those internet navigation keyboards will all kinds of nifty buttons on it and when you press them some (green) overlay will be displayed. really similar what you see on your tv actually. hows it going, shed any light on the problem? nope, no light. and the "CopyRect 0,0, 640, 480, 0,0, FrontBuffer(), BackBuffer()" doesn't prevent the (full)screen from flickering as soon as i start to use copyrect for other graphics. i am using blitz3d. so, i still am pretty clueless. |
| ||
mysterious... I am not using Blitz3D, so I can't offer you more... all the best though... |