Texture access in GLSL

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)

Look again in the OpenGL specs. :wink:
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.

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