PDA

View Full Version : Texture access in GLSL



martinho_
01-25-2005, 02:42 PM
When using a texture access funcion, like texture2D, in a shader, it returns a vec4 value.

Of course if the texture accessed through the sampler is an RGBA texture this values match the Red, Green, Blue and Alpha values, but what happens exactly if it is a rgb, luminance, alpha, luminance_alpha or intensity value?

(If found no information about that in both the gl2 and glsl specs)

Relic
01-25-2005, 10:00 PM
Look again in the OpenGL specs. ;)
It's described in the pixel operations, chapter 3.6 Conversion to RGB and Final Expansion to RGBA or see table 3.13.
Chapter 3.18 Table 3.15 shows how the input is mapped to the internalFormat.

mrbill
01-26-2005, 02:26 AM
Relic, close. But you need to know given a texture base internal format, what is the texel source color.

p. 184, Table 3.21: Correspondence of filtered texture components to texture source components.

-mr. bill