Jump to content
  • Advertisement
Sign in to follow this  
Brocketino

OpenGL Problem with ChoosePixelFormat

This topic is 4972 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I just installed windows XP and now the execution of my opengl applications halts at the ChoosePixelFormat call ( ChoosePixelFormat never returns? ) in the initialization process. Does anyone know how to fix this problem? The problem only occurs if i'm not switching to fullscreen, could it have something to do with the 'style' of the window? Right now i'm using WS_OVERLAPPEDWINDOW, WS_EX_APPWINDOW | WS_EX_WINDOWEDGE. [Edited by - Brocketino on March 10, 2005 11:19:02 AM]

Share this post


Link to post
Share on other sites
Advertisement
My window function uses the same styles and works fine, so that can be ruled out as the problem.

Have you tried using GetLastError() to get more info on the problem? It helped me when developing my window functions.

Share this post


Link to post
Share on other sites
Quote:
Original post by moonshine
Have you tried using GetLastError() to get more info on the problem? It helped me when developing my window functions.


I can't use GetLastError because the ChoosePixelFormat never returns!

Share this post


Link to post
Share on other sites
It would probably help if you would post the code where you get the DC and the PIXELFORMATDESCRIPTOR, and then show the line where you actually call ChoosePixelFormat().

Share this post


Link to post
Share on other sites
Quote:
Original post by mumpo
It would probably help if you would post the code where you get the DC and the PIXELFORMATDESCRIPTOR, and then show the line where you actually call ChoosePixelFormat().


k. Here it is:)


BOOL CGLScene::Create(HWND hwnd, int bpp)
{
int PixelFormat;

static PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR),
1,
PFD_DRAW_TO_WINDOW |
PFD_SUPPORT_OPENGL |
PFD_DOUBLEBUFFER,
PFD_TYPE_RGBA,
bpp,
0,0,0,0,0,0,
0,
0,
0,
0,0,0,0,
32,
0,
0,
PFD_MAIN_PLANE,
0,
0,0,0 };

if(!(m_hdc = GetDC( hwnd )))
return FALSE;

if(!(PixelFormat = ChoosePixelFormat( m_hdc, &pfd )))
return FALSE;

if(!(SetPixelFormat(m_hdc,PixelFormat,&pfd)))
return FALSE;

if(!(m_hrc = wglCreateContext(m_hdc)))
return FALSE;

if(!(wglMakeCurrent(m_hdc,m_hrc)))
return FALSE;

return TRUE;
}

Share this post


Link to post
Share on other sites
Quote:
Original post by Brocketino
...I just installed windows XP...


You did update all your drivers too, correct? If not, that could be a problem.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!