View Full Version : Texture Formats and FBO

08-18-2005, 05:35 AM

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

08-18-2005, 06:13 AM
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

08-18-2005, 12:20 PM
Allright, thanks a lot!