I suppose I should explain a bit more, sorry!
I can’t put all the code up but basically Ive been using code similar to below in a well tested app for the past few years. The opengl context in this case is:
double buffered
cols 32, Z 24, alpha 8
The card is a (dont laugh) GeForce2 Mx 200 on xp pro.
//old code:
case WM_PAINT:
{
PAINTSTRUCT ps;
BeginPaint(ghWnd, &ps);
RenderScene(); //all opengl calls
SwapBuffers(ghDC);
EndPaint(ghWnd, &ps);
}
return 0;
break ;
This works ok until I get overlapping windows and the scene is complicated and of course it slows down (but thats another story). Anyway, in the msdn docs it states you can’t perform gdi calls on a double buffered window but the other day I thought Id give it a go. Not as a replacement for the old code but just to see if it would work:
//test code
case WM_PAINT:
{
HDC hdcSrc;
PAINTSTRUCT ps;
HBITMAP hbmOld;
hdcSrc = CreateCompatibleDC(ghDC);
hbmOld = SelectObject(hdcSrc, ghCaptureBmp);
BeginPaint(ghWnd, &ps);
BitBlt(ghDC, 0, 0, swidth, sheight, hdcSrc, 0, 0, SRCCOPY);
EndPaint(ghWnd, &ps);
ghCaptureBmp = SelectObject(hdcSrc, hbmOld);
DeleteDC(hdcSrc);
}
return 0;
break ;
where ghCaptureBmp is a handle to a bitmap that has the same color depth as the system (and consequently the opengl context).
Anyway it worked - which was a bit of a surprise.
Now either 1) Ive always misunderstood the limitation on gdi calls to windows with opengl contexts that are double buffered or 2) the docs are wrong or 3) my card is odd.
Anybody any ideas?
Thanks in advance!
Andy