Melekor
07-16-2003, 09:58 AM
I want to be able to use GDI with my opengl program, sortof like directX lets you do.
I set off on a bit of a quest to find out how I could make my own version of swapbuffers that respects WS_CLIPCHILDREN so that I could use opengl and windows controls together without flickering. Here is what I've tried so far:
1. use PFD_DRAW_TO_BITMAP and then BitBlt to draw it to the screen. Works, but is not hardware accelerated and therefore unacceptably slow.
2. use a pbuffer, and then BitBlt from the pbuffer dc to the window dc. Doesn't work.
3. use a pbuffer and then use glReadPixels to copy the buffer contents to a DIB, then BitBlt to the window. A type of tripple-buffering, I guess. Works, has hardware acceleration but is WAAYY too slow because of glReadPixels. (glReadPixels takes 850 miliseconds for a 1024x1024 pbuffer!)
I also thought of intercepting all WM_PAINT, WM_NCPAINT, WM_ERASEBKGND messages and maybe handle them in a way that doesnt cause flicking, but actually I have no idea how to do that http://www.opengl.org/discussion_boards/ubb/frown.gif
That's all I've come up with so far. All my "solutions" just don't have good performance and I'm out of ideas. Has anyone got any other ideas that I can try?
Thanks for any help!
I set off on a bit of a quest to find out how I could make my own version of swapbuffers that respects WS_CLIPCHILDREN so that I could use opengl and windows controls together without flickering. Here is what I've tried so far:
1. use PFD_DRAW_TO_BITMAP and then BitBlt to draw it to the screen. Works, but is not hardware accelerated and therefore unacceptably slow.
2. use a pbuffer, and then BitBlt from the pbuffer dc to the window dc. Doesn't work.
3. use a pbuffer and then use glReadPixels to copy the buffer contents to a DIB, then BitBlt to the window. A type of tripple-buffering, I guess. Works, has hardware acceleration but is WAAYY too slow because of glReadPixels. (glReadPixels takes 850 miliseconds for a 1024x1024 pbuffer!)
I also thought of intercepting all WM_PAINT, WM_NCPAINT, WM_ERASEBKGND messages and maybe handle them in a way that doesnt cause flicking, but actually I have no idea how to do that http://www.opengl.org/discussion_boards/ubb/frown.gif
That's all I've come up with so far. All my "solutions" just don't have good performance and I'm out of ideas. Has anyone got any other ideas that I can try?
Thanks for any help!