Rendering in 10 bits using a FBO

I have a 10 bits frame buffer that works just fine. My cards, OpenGL, monitor, everything is 10 bits compatible and I have a very smooth image when I render directly to the framebuffer.

But now I try to use FBOs. I render my scene to an FBO, then use the FBO to display the final image on screen. At this point the image render is exactly the same as when I was rendering directly to the framebuffer. Except it isn’t that smooth anymore. It’s been converted to 8 bits in the process. I can see banding.

I tried everything I can think off:
- All kinds of color attachments : GL_RGBA12, GL_RGB10, GL_RGB16F, etc.
- I tried FBO using textures and and others using render buffer
- I tried bliting the FBO to the screen and writing my own shader to copy to image back to the frame buffer.

Every time, I get the same result: banding. It’s obvious I loose the 10 bits as soon as I render to an FBO, even if my FBO is 10 bits too.

Anyone knows how to use an FBO and stay in 10 bits?

How do you know that your OpenGL context has a default framebuffer containing 10+bits of color channel data? Sure, it looks “smooth”, but have you verified it directly, perhaps by querying the color bitdepth information from the default framebuffer?

Did you try GL_RGB10_A2? Because that would make the most sense here.

Yes, I did query the number of bits using WGL_COLOR_BITS_ARB and WGL_ALPHA_BITS_ARB, which gives me respectively 32 and 2. So 30 bits of color buffer, or 10 bits per component.

I should have mentioned it, as as you said, GL_RGB10_A2 makes more sense being a perfect match to my frame buffer. I did try it. Same result as with any other buffer. It gets converted to 8 bits somewhere in the process.Or at least, what I can say is I get banding just as if it was converted to 8 bits.