Hello guys, I have one serious problem with pixelformatdescriptor
…
static PIXELFORMATDESCRIPTOR pfd =
{
sizeof(PIXELFORMATDESCRIPTOR),
1,
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER,
PFD_TYPE_RGBA,
32,
0, 0, 0, 0, 0, 0,
0,
0,
0,
0, 0, 0, 0,
32,
0,
0,
PFD_MAIN_PLANE,
0,
0, 0, 0
};
if(!(hdc = GetDC(hwnd))) // Did We Get A Device Context?
{
KillGLWindow(); // Reset The Display
ShowCursor(true);
MessageBox(NULL, "Can't Create A GL Device Context.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
return FALSE; // Return FALSE
}
//DescribePixelFormat(hdc, PixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
// 650 handles
if(!(PixelFormat = ChoosePixelFormat(hdc, &pfd))) // Did Windows Find A Matching Pixel Format?
{
KillGLWindow(); // Reset The Display
ShowCursor(true);
MessageBox(NULL, "Can't Find A Suitable PixelFormat.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
return FALSE; // Return FALSE
}
// + another 1100 handles
if(!SetPixelFormat(hdc, PixelFormat, &pfd)) // Are We Able To Set The Pixel Format?
{
KillGLWindow(); // Reset The Display
ShowCursor(true);
MessageBox(NULL, "Can't Set The PixelFormat.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
return FALSE; // Return FALSE
}
if(!(hRC = wglCreateContext(hdc))) // Are We Able To Get A Rendering Context?
{
KillGLWindow(); // Reset The Display
ShowCursor(true);
MessageBox(NULL, "Can't Create A GL Rendering Context.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
return FALSE; // Return FALSE
}
if(!wglMakeCurrent(hdc, hRC)) // Try To Activate The Rendering Context
{
KillGLWindow(); // Reset The Display
ShowCursor(true);
MessageBox(NULL, "Can't Activate The GL Rendering Context.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
return FALSE; // Return FALSE
}
if(!InitGL()) // Initialize Our Newly Created GL Window
{
KillGLWindow(); // Reset The Display
ShowCursor(true);
MessageBox(NULL, "Initialization Failed.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
return FALSE; // Return FALSE
}
…
Everything works like a charm but one thing. Handles of the application radicaly increase once I ChoosePixelFormat - handles in TaskMgr grow up to 650 handles and after wglCreateContext it increases of another 1100 handles, so my app ends up with something around 1800 handles. My question is simple, is that radical handle increase normal?
Thank you all in advance