Texture Formats and FBO


I’ve two questions about textures with texture format GL_LUMINANCE and GL_LUMINANCE_ALPHA.
-) When using GLSL in which components (r,g,b,a) do I get a value when sampling a texture with one of those two formats?
-) When rendering to a FBO with a color texture using one of those two formats where do I have to write the values (r,g,b,a) in glFragData[] within a GLSL fragment shader?

Thanks a lot

In GLSL all the texture built-in functions return four components, rgba. These are unpacked from the texture source components to the texel based on the Texture Base Internal Format (Alpha, Luminance, Luminance_Alpha, Intensity, RGB, RGBA).

See Table 3.21 in The OpenGL Graphics System: A Specification (Version 2.0 - October 22, 2004), p. 184.

Luminance -> vec4( L,L,L,1.0 )
Luminance_Alpha -> vec4( L,L,L,A )

For Framebuffer Objects, unfortunately, LUMINANCE or LUMINANCE_ALPHA are NOT “color-renderable”.

See 4.4.4 Framebuffer Completeness in the EXT_frambuffer_object extension:


  • An internal format is “color-renderable” if it is RGB, RGBA, or one of the formats from table 3.16 whose base internal format is RGB or RGBA. No other formats, including compressed internal formats, are color-renderable.
    -mr. bill

Allright, thanks a lot!