PDA

View Full Version : little problem with WGL_ARB_pixel_format



Diapolo
10-20-2002, 02:22 PM
Hi,

I try to enumerate, how many pixelformats the driver gives me, via this code:

int iNum_PFs = 0;
int iPFResults[8];
memset(&iPFResults, 0, sizeof(iPFResults));
int iPFAttributes[8];
memset(&iPFAttributes, 0, sizeof(iPFAttributes));

iPFAttributes[0] = WGL_NUMBER_PIXEL_FORMATS_ARB;

wglGetPixelFormatAttribivARB(hDC, 1, NULL, 1, iPFAttributes, iPFResults);
iNum_PFs = iPFResults[0];

You see I use the parameter 1 after hDC.
I saw in a NV PDF file, that they used 0 there.
If I do this, the return value for the number of PFs is zero, which canīt be right http://www.opengl.org/discussion_boards/ubb/smile.gif.

Any ideas and is my solution OK or will there be problems if I use the 1 there (because the 1 is the first pixelformat)?

Regards,
Diapolo

Humus
10-20-2002, 08:45 PM
That shouldn't be a problem. From the spec:

WGL_NUMBER_PIXEL_FORMATS_ARB
The number of pixel formats for the device context. The <iLayerPlane> and <iPixelFormat> parameters are ignored if this attribute is specified.

Diapolo
10-20-2002, 11:24 PM
Ah OK, thank you very much http://www.opengl.org/discussion_boards/ubb/smile.gif!

Diapolo

Cab
10-21-2002, 12:16 AM
It seems there is a small 'problem' in lastest nVidia drivers.
You can see PBrown's comment about it: http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/007580.html

(Yes, currently you can solve it using 1 after hDC).

Hope this helps.

Diapolo
10-21-2002, 05:48 AM
Thanks for the additional info http://www.opengl.org/discussion_boards/ubb/smile.gif.
I was pretty sure, itīs a driver bug and not my fault http://www.opengl.org/discussion_boards/ubb/biggrin.gif.

Diapolo

pbrown
10-21-2002, 06:40 AM
Originally posted by Diapolo:
Thanks for the additional info http://www.opengl.org/discussion_boards/ubb/smile.gif.
I was pretty sure, itīs a driver bug and not my fault http://www.opengl.org/discussion_boards/ubb/biggrin.gif.

Diapolo

Either way we implement it, it will be a driver bug. That's what internally inconsistent specs will do to you. :-)

Diapolo
10-21-2002, 07:35 AM
LOL ... but great, that you have fun while saying that http://www.opengl.org/discussion_boards/ubb/wink.gif.

The ARB should phrase better specs in some cases, right http://www.opengl.org/discussion_boards/ubb/biggrin.gif?

Diapolo

Humus
10-21-2002, 08:50 AM
While the spec could have been worded better I think it's pretty much obvious anyway that the intention was that you should only need to provide a valid pixel format index if the parameter you're requesting requires it.

mcraighead
10-22-2002, 02:45 AM
Spec language always trumps spec intent. If the spec specifies useless behavior, useless behavior is what you get.

- Matt

NitroGL
10-22-2002, 07:32 AM
You guys in the ARB really should update it then... You know... Fix these little inconsistencies in the specs...

Just a throught. http://www.opengl.org/discussion_boards/ubb/smile.gif