PDA

View Full Version : delay in ChoosePixelFormat



Zohar
07-20-2005, 01:42 AM
Hi,

I'm running the following code, and get a 10 sec. delay between the two 'cout's:



void setupPixelFormat(HDC hDC)
{
PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR), // size
1, // version
PFD_SUPPORT_OPENGL |
PFD_DRAW_TO_WINDOW |
PFD_DOUBLEBUFFER, // support double-buffering
PFD_TYPE_RGBA, // color type
16, // prefered color depth
0, 0, 0, 0, 0, 0, // color bits (ignored)
0, // no alpha buffer
0, // alpha bits (ignored)
0, // no accumulation buffer
0, 0, 0, 0, // accum bits (ignored)
16, // depth buffer
0, // no stencil buffer
0, // no auxiliary buffers
PFD_MAIN_PLANE, // main layer
0, // reserved
0, 0, 0, // no layer, visible, damage masks
};
int pixelFormat;

cout << "before ChoosePixelFormat\n";
pixelFormat = ChoosePixelFormat(hDC, &amp;pfd);
if ( pixelFormat == 0 )
{
MessageBox(WindowFromDC(hDC), "ChoosePixelFormat failed.", "Error",
MB_ICONERROR | MB_OK);
exit(1);
}
cout << "after ChoosePixelFormat\n";

if ( SetPixelFormat(hDC, pixelFormat, &amp;pfd) != TRUE )
{
MessageBox(WindowFromDC(hDC), "SetPixelFormat failed.", "Error",
MB_ICONERROR | MB_OK);
exit(1);
}
}I'm running .Net 2003 on win2k pro, with GeForce 2.

Thanks.