View Full Version : Weird thing with DescribePixelFormat
09-15-2000, 06:10 AM
Does anyone have an idea why I have to call a GL function before I can get the number of pixel formats supported. In the following code, if I remove glLoadIdentity() (and do a Rebuild All), DescribePixelFormat returns 0. I thought this could be an ICD problem but I tried it on a G400 and a GeForce2 and I got the same problem.
int APIENTRY WinMain( HINSTANCE hInstance,
hDC = GetDC(NULL);
// Any GL function...
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
int nFormatCount = DescribePixelFormat (hDC, 1, 0, NULL);
09-15-2000, 07:09 AM
If I recall correctly, you have to set the pixel format before you can describe it. If you dont set it explicity and then begin issuing commands, I believe it will pick a default format for you. Try using ChoosePixelFormat and SetPixelFormat before you do the describe. These functions are documented in the Win API.
09-15-2000, 08:24 AM
Heh - I think I've seen this.
It's a linker problem. Your OGL call is doing nothing - you don't have an RC selected so it'll just fail. But unless you have an OGL function somewhere in your program, the MSVC linker doesn't link against the OpenGL import lib/dll.
Now, the WGL functions require that your app is linked to OpenGL, and assume that you're already doing so - otherwise why would you want to call WGL? It doesn't load the dll itself, so in your case it just fails.
Don't ask how long it took me to track that one down...
09-15-2000, 09:29 AM
I came to the same conclusion and you confirmed it, thanks ! But there is got to be a way around it. DX can do it so why can't GL do it. Let me explain : I'm trying to get the number of OGL drivers before any window creation. DX has a function for that :
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.