Pixelformat issue
Hi,
I have a strange problem. I use the following code:
PIXELFORMATDESCRIPTOR pfd;
int iFormat;
// set the pixel format for the DC
ZeroMemory( &pfd, sizeof( pfd ) );
pfd.nSize = sizeof( pfd );
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 16; // I also tried with 32
pfd.cDepthBits = 16;
iFormat = ChoosePixelFormat( m_hDC, &pfd );
BOOL result = SetPixelFormat( m_hDC, iFormat, &pfd );
if my screen is in 16 bits per pixel, this initialization code is fine and my rendering is ok. If I set my screen in 32 bits per pixel, the initialization code is fine (result is TRUE and iFormat is > 0) but the rendering does not occur.
Any idea ? This happens on several machines (w2k) with different video cards.
Thanks a lot
[edited by - aircom on April 22, 2003 4:09:26 PM]
I should have added that I use MFC, that the opengl code is embedded in a custom control shown in a dialog box.
No ideas ?
Thanks
No ideas ?
Thanks
Unfortunately all combinations doesn't work more.
I have really no idea what happens. ChoosePixelFormat and SetPixelFormat all returns valid results and I see nothing (with a 32 colorbits).
Thank you
[edited by - aircom on April 23, 2003 12:19:51 PM]
I have really no idea what happens. ChoosePixelFormat and SetPixelFormat all returns valid results and I see nothing (with a 32 colorbits).
Thank you
[edited by - aircom on April 23, 2003 12:19:51 PM]
It may be win2k itself ???
If you want you could email the source or executable and I could test it to see if I can get it to work (winXP/98 - nVidia).
Luigi
www.lp23.com
[edited by - lp23 on April 23, 2003 1:44:47 PM]
If you want you could email the source or executable and I could test it to see if I can get it to work (winXP/98 - nVidia).
Luigi
www.lp23.com
[edited by - lp23 on April 23, 2003 1:44:47 PM]
Here it is. I isolated the problem.
My control is inside a groupbox. If I move it outside, it displays correctly. If a part is in the groupbox, this part is not displayed and the other part is displayed, as if opengl was clipped by the groupbox !!!!!
The conclusion is that a SetWindowPos(&wndTop, ...) will work for me. But this problem is really weird. I can't see the link between opengl being clipped by a groupbox (although the containing control is not : if I use GDI to draw in it it displays correctly) and the screen depth (displays ok in 16 bits but not in 32 bits).
Although my problem is solved, if someone has the beginning of an explanation ...
Thank you
[edited by - aircom on April 23, 2003 3:18:28 PM]
My control is inside a groupbox. If I move it outside, it displays correctly. If a part is in the groupbox, this part is not displayed and the other part is displayed, as if opengl was clipped by the groupbox !!!!!
The conclusion is that a SetWindowPos(&wndTop, ...) will work for me. But this problem is really weird. I can't see the link between opengl being clipped by a groupbox (although the containing control is not : if I use GDI to draw in it it displays correctly) and the screen depth (displays ok in 16 bits but not in 32 bits).
Although my problem is solved, if someone has the beginning of an explanation ...
Thank you
[edited by - aircom on April 23, 2003 3:18:28 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement