PDA

View Full Version : create a rendering context in Win32



jyoung77
04-30-2003, 12:11 PM
Hi,

I want to create a rendering context in Win32 for a whole screen but both of the following pieces of code always return. Do you know why? Please help. Thanks. Tony

// Piece 1
CWnd *pWnd = AfxGetMainWnd();
CWindowDC dc(pWnd);
HGLRC hrc = wglCreateContext(dc.m_hDC);
if (!hrc)
return;

// Piece 2
CWindowDC dc(NULL);
HGLRC hrc = wglCreateContext(dc.m_hDC);
if (!hrc)
return;

knackered
04-30-2003, 12:35 PM
You need to set the pixel format of the window to PFD_SUPPORT_OPENGL, amongst other attributes.
Look up SetPixelFormat and PIXELFORMATDESCRIPTOR.