View Full Version : Flicker with openGL and UpdateLayeredWindow

David Patte
03-02-2011, 11:18 AM
I have an app that has problems with flickering.

Let me explain how the application works which is non-standard.

1) I use wglChoosePixelFormatARB with a parameter of 4 to try to find 4x multisampling. If that fails i try for 2x, otherwise i default to normal pixel format.

2) I am enabling 4xAA using glEnable(GL_MULTISAMPLE_ARB) when I init.

3) I once per second, I use simple gl commands to draw to the back buffer and call glFinish, then copy the backbuffer to a DIB using glReadPixels where I am doing some extra processing to the image using GDI.

5) The result is finally drawn to windows using UpdateLayeredWindow.

I can see that when I call UpdateLayeredWindow the resultant DIB does appear on the screen, but the temporary backbuffers flicker on the screen as well.

What could cause the back buffer to appear on the windows desktop. Im not calling swapbuffers at all, as far as I know.

David Patte
03-02-2011, 05:22 PM
Problem resolved.

I wrapped the code that draws on the backbuffer so its the only time its visible. Otherwise, I make it invisible.

It needs to be visible to be drawn using openGL, but invisible at all other times to prevent updatelayeredWindow from copying the 'empty' front buffer to the screen.