PDA

View Full Version : Querying default framebuffer color bits (OpenGL 3)



Dan Bartlett
05-12-2009, 07:33 AM
Hi,
How do you query the the number of bits used by the color/depth/stencil buffers in the default framebuffer in OpenGL 3.1+? (prior to 3.1 could use glGetIntegerv(GL_RED_BITS, @Result))

I tried:
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFF ER, GL_FRONT_LEFT, GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE, @Result);

but I get an "invalid enumerant" error on NVidia 182.52 drivers.

Is this a driver bug, or am I doing something wrong?

dsewtz
05-25-2011, 10:44 AM
I have the same question: How can i get the internal rgba bitsizes?
I tried glGetFramebufferAttachmentParameter
and glGetRenderBufferAttachmentParameter.
I also tried the same on the BACK_LEFT and BACK_RIGHT buffers.

Does anyone know how to do this by now?

kyle_
05-25-2011, 01:33 PM
I tried:
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFF ER, GL_FRONT_LEFT, GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE, @Result);

This should (specification defines it to) work.
If it doesn't, its a driver bug.

Alfonse Reinheart
05-25-2011, 01:39 PM
but I get an "invalid enumerant" error on NVidia 182.52 drivers.

182.52? Those are two year old drivers. GL 3.0 was still fairly new then. Upgrade to some newer ones. However, there may be some issues (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=296625#Post2966 25) with the most recent, so get a slightly older version than those.

Dan Bartlett
05-25-2011, 04:19 PM
The question was asked 2 years ago, but out of interest I thought I'd check it again.

On NVidia 257.15 + 270.61 drivers, and also on ATI 11.3 drivers, querying the default framebuffer in this way still returns INVALID_ENUMERANT.

Calling glGetIntegerv(GL_RED_BITS, @Result) in a core profile also returns INVALID_ENUMERANT, so you can't query the default framebuffer properties at all unless you use compatibility profile.

skynet
05-26-2011, 01:14 AM
Calling glGetIntegerv(GL_RED_BITS, @Result) in a core profile also returns INVALID_ENUMERANT, so you can't query the default framebuffer properties at all unless you use compatibility profile.

For the default framebuffer, you could use wglGetPixelFormatAttribivARB(). Unfortunately, this won't return actual format identifiers...just number of bits and so on.

sqrt[-1]
09-20-2011, 06:28 PM
I just installed the latest Nvidia drivers (280.26)and it seems that this is still broken?

Calls to:
glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFF ER,GL_DEPTH,GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, ..)
or
glGetFramebufferAttachmentParameteriv(GL_DRAW_FRAM EBUFFER,GL_STENCIL,GL_FRAMEBUFFER_ATTACHMENT_OBJEC T_TYPE,..)

Both generate GL_INVALID_ENUM (have checked that there is no FBO bound)