Anyone know why the method DescribePixelFormat() returns the pixel format does not support OpenGL (PFD_SUPPORT_OPENGL=false) while the ARB extension through wglGetPixelFormatAttribivARB() method returns the same pixel format supports OpenGL (WGL_SUPPORT_OPENGL_ARB=true)?

I find a suitable pixel format that supports openGL with wglChoosePixelFormatARB() function and when informed of their characteristics to the user by DescribePixelFormat() function, returns that does not support OpenGL.

is that correct?


The specification gives an answer to your question quite obviously. :slight_smile:

I understand that new features can not be understood by older methods.

But if both attributes have the same meaning (opengl support), why not return the same value?

Are you saying that these two attributes are not equivalent?

Sorry if it’s obvious, but do not quite understand

Thanks again.

Just use wglGetPixelFormatAttribivARB to query attributes, and read WGL_SUPPORT_OPENGL_ARB.

DescribePixelFormat() returns informations for ALL pixel formats, not just the OpenGL supported once. That includes printer formats and device independent (DRAW_TO_BITMAP) pixel formats. Some of these formats just support the Mircosoft Generic OpenGL software implementation, and some don’t support OpenGL at all.

The extension on the other hand, are implemented via the OpenGL driver of your graphic adapter, and thus only know their own capabilities.

OK, but in this case, I select the pixel format number 34 returned by wglChoosePixelFormatARB() (I want a pixel format that supports multisample):

[b]int iAttributes[] = { WGL_DRAW_TO_WINDOW_ARB,GL_TRUE,
WGL_SAMPLES_ARB, 4 , // Check For 4x Multisampling

valid = wglChoosePixelFormatARB(hDC,iAttributes,fAttributes,nMaxPixelFormats,pixelFormat,&numFormats);[/b]

So DescribePixelFormat(), for the index 34, returns the PFD_SUPPORT_OPENGL bit off.

And wglGetPixelFormatAttribivARB(), for the index 34, returns the attribute WGL_SUPPORT_OPENGL_ARB true.

All other parameters in both functions are equivalent.

…And after setting that pixel format (ID=34), can you draw using OpenGL?

Yes, everything works perfectly.

The “problem” is the user was seeing on a dialog box that the program did not support OpenGL, when it was not true. And that confused me. Ignoring this detail, everything is perfect.

I’ve corrected the problem by using wglGetPixelFormatAttribivARB when available

Thanks for the help.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.