PDA

View Full Version : attaching snorm texture to fbo



rainbows
11-02-2011, 10:45 PM
I would like to use an fbo to render out to a texture with an internal format of gl_rgba16_snorm or gl_rgba8_snorm. I tried attaching it to the fbo but i get GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT.

Under the FBO completeness rules, the textures need to be color-renderable. Are snorm textures color-renderable? I looked through section 4.4.4 of the opengl spec and it seems like they are. I would really appreciate any insight on this matter.

Alfonse Reinheart
11-02-2011, 10:54 PM
None of the SNORM formats are on the list of required texture formats for renderbuffers (GL 3.3 spec, section 3.8.3). So there's a good chance that you won't be able to render to them.

Remember: the implementation of can reject formats that it doesn't like (except for those on that list). Normally, this should give you GL_FRAMEBUFFER_UNSUPPORTED. So check to see if you initialized the texture correctly. Without errors and such. Make sure that the texture was complete and no GL errors were given.

rainbows
11-02-2011, 11:07 PM
Yes i made sure the texture was initialized correctly without any errors. Everything works properly if I don't use snorm textures.

Yeah it's curious that I'm getting GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT.

rainbows
11-03-2011, 01:11 AM
Well after careful reading of the OpenGL 4.2 specs, I found that the snorm textures are not part of the required framebuffer formats. Only the color formats for "textures and renderbuffers" are required. This doesn't include the snorm textures which are a part of the "texture-only" color formats.




Quote from section 4.4.4 of the OpenGL 4.2 specs.

Required Framebuffer Formats
Implementations must support framebuffer objects with up to MAX_COLOR_-
ATTACHMENTS color attachments, a depth attachment, and a stencil attachment.
Each color attachment may be in any of the required color formats for textures
and renderbuffers described in sections 3.9.3 and 4.4.2.



Quote from section 3.9.3 of the OpenGL 4.2 specs.

Texture and renderbuffer color formats (see section 4.4.2).
RGBA32F, RGBA32I, RGBA32UI, RGBA16, RGBA16F, RGBA16I,
RGBA16UI, RGBA8, RGBA8I, RGBA8UI, SRGB8_ALPHA8, RGB10_A2,
RGB10_A2UI, RGB5_A1, and RGBA4.
OpenGL 4.2 (Core Profile) - August 8, 2011
3.9. TEXTURING 213
R11F_G11F_B10F and RGB565.
RG32F, RG32I, RG32UI, RG16, RG16F, RG16I, RG16UI, RG8, RG8I,
and RG8UI.
R32F, R32I, R32UI, R16F, R16I, R16UI, R16, R8, R8I, and R8UI.

Hope this helps someone else too!