OpenGL Initialization problem

Started by
5 comments, last by hpolloni 19 years, 7 months ago
Why the opengl window could not be created at out of the screen(desktop)? There is no problem if i use PFD_SUPPORT_GDI. But, PFD_SUPPORT_GDI and PFD_DOUBLEBUFFER flags are mutually exclusive in the current generic implementation. i would be glad if somebody help me. thanks acraft
Advertisement
I don't know but it will be a problem becaouse GDI doesn't support double buffering so you will have fliker .
Be more specific with your initializing problem.
i don't use PFD_SUPPORT_GDI. I mean there is no problem if i use PFD_SUPPORT_GDI.

here is my implementation

pixelDesc.dwFlags = PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL;

initialization does not work if you create window at out of the screen. I see only a black window.
PFD_TYPE_RGBA i would add if you don't use indexed palletes but this is not it.
After creating the window did you queried ShowWindow(HWND,SW_SHOW)
Post some CODE more precisly the PIXELFORMATDESCRIPTOR initialization

you used PFD_MAIN_PLANE(main drawing layer i hope)

*Try to find the error by putting MessageBox all over to see where the initialization fails (which is the last message you see) or follow the values of HWND or HDC,HGLRC if not NULL
all the critic stuation has being checked and work well except at out of screen.

everything is working with using PFD_SUPPORT_GDI or PFD_DOUBLEBUFFER.

at out of the screen, only PFD_SUPPORT_GDI works, PFD_DOUBLEBUFFER not..

here is my pixdesc implemantation

PIXELFORMATDESCRIPTOR pixelDesc;

pixelDesc.nSize = sizeof(PIXELFORMATDESCRIPTOR);
pixelDesc.nVersion = 1;
pixelDesc.dwFlags = PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL;
pixelDesc.iPixelType = PFD_TYPE_RGBA;
pixelDesc.cColorBits = 32;
pixelDesc.cRedBits = 0;
pixelDesc.cRedShift = 0;
pixelDesc.cGreenBits = 0;
pixelDesc.cGreenShift = 0;
pixelDesc.cBlueBits = 0;
pixelDesc.cBlueShift = 0;
pixelDesc.cAlphaBits = 0;
pixelDesc.cAlphaShift = 0;
pixelDesc.cAccumBits = 0;
pixelDesc.cAccumRedBits = 0;
pixelDesc.cAccumGreenBits = 0;
pixelDesc.cAccumBlueBits = 0;
pixelDesc.cAccumAlphaBits = 0;
pixelDesc.cDepthBits = 16;
pixelDesc.cStencilBits = 0;
pixelDesc.cAuxBuffers = 0;
pixelDesc.iLayerType = PFD_MAIN_PLANE;
pixelDesc.bReserved = 0;
pixelDesc.dwLayerMask = 0;
pixelDesc.dwVisibleMask = 0;
pixelDesc.dwDamageMask = 0;

int m_GLPixelIndex;

if ( (m_GLPixelIndex = ChoosePixelFormat( hDC, &pixelDesc )) == 0 ) // Let's choose a default index.
{ m_GLPixelIndex = 1;
if ( DescribePixelFormat( hDC, m_GLPixelIndex, sizeof(PIXELFORMATDESCRIPTOR), &pixelDesc) == 0 )
{ return FALSE;
}
}

if ( SetPixelFormat(hDC, m_GLPixelIndex, &pixelDesc) == FALSE )
{ return FALSE;
}

return TRUE;

I really can't see what's wrong ,i wish i could help.
do you get the dc for the window created?

hint: hDC = GetDC(hWnd);

This topic is closed to new replies.

Advertisement