Flicker problem: drawing every other frame

Started by napier, June 04, 2004, 05:21:40

Previous topic - Next topic

napier

I wrote an LWJGL program which runs at 60 fps with the Display frequency set to 60 and all is well.  I add more objects to the scene with heavy alpha blending and of course my framerate drops to 30 since the rendering is too heavy to finish in 1/60 sec.  

At this point I expect my frames to get a little choppier, but what I'm seeing is that objects are appearing in every other frame when the framerate drops to 30 fps.  

I'm drawing without clearing the background before each frame (leaving trails behind as the objects move) and I see that at 30 fps the trails are drawn into every other frame.  The trail of an object will appear in frame 1, not be in frame 2, then be in frame 3, not in 4, etc.  At 1 frame per second I can see that the there appears to be two frame buffers, one containing part of the trail and the other containing the other part, and the two frames are alternating.  At 30 fps it appears as flickering.

Oddly enough, if I open a memory hog app (3DS Max or Jbuilder9) and then run my program, it runs fine at any frame rate!

Is this a swap-the-buffers issue? Is my approach of not clearing the framebuffer not really supported?  Anybody seen anything like this?

(Using lwjgl version .8,  Nvidia Geforce4 MX 420, Windows XP)
penGL/Java/LWJGL demos and code: http://potatoland.org/code/gl

elias

When you swap buffers in a double buffered environment, the back buffer content is undefined. So you can't rely on the old content being there.

- elias

napier

thanks elias, I thought that might be the case.  It's interesting that the behavior changed based on other apps being loaded, but I suppose that's an anomaly based on resource usage.
penGL/Java/LWJGL demos and code: http://potatoland.org/code/gl