Below is my code. I can’t seem to understand whats wrong with it.
I’m getting a very wierd error number too.
m_GLPixelIndex = 4
and
errCode = 3221684230 ?
Anyone has an idea ?
bool GL3DView::setFormat()
{
//HWND hMainWnd = ::GetDesktopWindo();
//HDC hMainDC = ::GetDC(hMainWnd);
HDC hDC = qt_display_dc();
PIXELFORMATDESCRIPTOR pixelDesc = // pfd Tells Windows How We Want Things To Be
{
sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor
1, // Version Number
PFD_DRAW_TO_WINDOW | // Format Must Support Window
PFD_SUPPORT_OPENGL | // Format Must Support OpenGL
PFD_DOUBLEBUFFER, // Must Support Double Buffering
PFD_TYPE_RGBA, // Request An RGBA Format
24, // Select Our Color Depth
0, 0, 0, 0, 0, 0, // Color Bits Ignored
0, // No Alpha Buffer
0, // Shift Bit Ignored
0, // No Accumulation Buffer
0, 0, 0, 0, // Accumulation Bits Ignored
16, // 16Bit Z-Buffer (Depth Buffer)
0, // No Stencil Buffer
0, // No Auxiliary Buffer
PFD_MAIN_PLANE, // Main Drawing Layer
0, // Reserved
0, 0, 0 // Layer Masks Ignored
};
int m_GLPixelIndex = ChoosePixelFormat(hDC,&pixelDesc);
if(SetPixelFormat(hDC,m_GLPixelIndex,&pixelDesc)==FALSE)
{
DWORD errCode = GetLastError();
return FALSE;
}
return TRUE;
}