PDA

View Full Version : Problem calling GDI after SwapBuffers()



daniel_oberlin
11-22-2002, 06:22 AM
Hi folks;

I'm working on an interactive modeling program using OpenGL. My application runs on Win32, and I'm using double buffering. Sometimes I need to use GDI to do some drawing on top of the window after I have called SwapBuffers().

I've experimented some, and I am coming to the inescapable conclusion that the actual buffer swap is delayed and is happening after I make my GDI calls. Here's the order of things:

1. Do OpenGL rendering
2. SwapBuffers()
3. glFlush()
4. GDI calls

And yet it seems that my OpenGL graphics are in fact overwriting the display generated by my GDI calls.

If I insert a long delay between just before calling GDI, then it works as expected.

Can anyone explain what is going on here?

Thanks,
Dan

Asgard
11-22-2002, 06:36 AM
Have you tried to call glFinish instead of glFlush?

daniel_oberlin
11-22-2002, 06:40 AM
Perfect. Thanks!

I wasn't aware of glFinish(), just looked it up. Things work now.