PDA

View Full Version : in MDI in MDI how do I get correct DC



REM
11-22-2002, 05:08 PM
m_hgldc = ::GetDC(m_hWnd);
if(!SetPixelformat(m_hgldc)) // set pixel format
{
::MessageBox(::GetFocus(),"SetPixelformat Failed!","Error",MB_OK);
exit(0);

}


When I try to OpenGL SwapBackBuffer the whole screen goes black, this code works with one window. But not MDI. Can someone help me, much thanks and God bless ya.

REM
11-22-2002, 05:10 PM
Oh and its in MFC.

Deiussum
11-25-2002, 05:28 AM
Do you have that code in the CView derived classes?

Also, be sure and use wglMakeCurrent when you redraw the scenes for each CView.

Also, you should make sure that in the PreCreateWindow, you create a new window class to use which has the CS_OWNDC flag set.