1

I'm creating an OpenGL render context on Windows, using ChoosePixelFormat, SetPixelFormat, etc. This all works beautifully, however, just before the OpenGL content is drawn, the window is set to all white. Briefly, but still visible.

The background brush on the window class is GetStockObject(HOLLOW_BRUSH), I do not respond to either WM_ERASEBKGND or WM_PAINT, and the OpenGL context is cleared with black immediately. This all doesn't seem to matter.

I can also reproduce this problem if I turn off the OpenGL render loop temporarily while running, hide and then show the window. This makes it completely white.

It looks like Windows is clearing the window if it is set as an OpenGL render target, and it's using white for this. Is this a known issue and is there any way to control the default color? Black would be much better. Thanks!

(Using Windows 7 with an ATI Radeon HD5750 adapter.)

Frederik Slijkerman
  • 6,471
  • 28
  • 39

2 Answers2

0

I had this problem too. I had to handle the WM_ERASEBKGND message by doing nothing and returning true to prevent the white flicker.

Tim
  • 11
0

The solution for me was to draw something when the first WM_PAINT message arrives.

Frederik Slijkerman
  • 6,471
  • 28
  • 39