Hi, I’ve brought this up in the past but couldn’t find a complete solution… and it’s about time I find a definite fix or else it looks like management might press me into ditching OGL altogether and go with D3D :\
The difficulty is getting Win32 GDI and OGL to get along nicely.
I’m drawing GDI stuff over a double buffered OGL window. Singlebuffering is not an option, neither is rendering to a bitmap via software, and neither is reimplementing half the GDI to go via OGL.
What happens, apparently only on NVidia (but I’m not 100% sure), is that the GDI is drawn before the swapbuffer is finished. So, some parts of the GDI are drawn, others are not.
The problem is almost completely gone if I add a sleep (50 msecs) between the Swapbuffers and the GDI calls – clearly suggesting a timing issue.
What really bugs me though is that I can’t always do this. When a user closes a menu (so it nicely alpha-fades out, you know the win2k stuff) or does other things that cause win32 to draw GDI over the OGL backdrop, the image becomes wrong again. I seem to get lagged frames, almost as if the swap was done before the driver realizes that the area where the menu/dialogbox used to be is now clear again and should be swapped too. So it swaps the buffer, but leaves the used-to-be-covered area unswapped, showing an old frame. Disastreous.
I’ve been messing with swapping extensions, doing readpixels to force a 3d pipeline flush, adding more sleep, etc… Nothing helps.
So does this sound familiar to anybody ? Any tips or ideas ?.. :[