GL_LUMINANCE problem

i read an article,it says that" if the value for a given texel is X,then the RGBA vector generated is GL_LUMINANCE:RGBA=(X,X,X,1)"

i do not understand it clearly,X should also have its own RGBA,so GL_LUMINANCE equals (RGBA,RGBA,RGBA,1)?

Can someone explain GL_LUMINANCE for me in detail?

Shaders read back 4 components using the .r, .g, .b or .a qualifiers. However, GL_LUMINANCE texture is just a single channel texture format. Therefore in your shaders when you read the tetxure using one of the sampler uniforms, the value you read will have been automatically applied to all qualifiers. In other words it does not matter if you sample your texture with tex.r, tex.g, tex.b or tex.a - all will have the same value.

GL_LUMINANCE texture is just a single channel texture format.
I want to know GL_LUMINANCE keeps which channel as the luminance value? (R,R,R,1) or (G,G,G,1) or (B,B,B,1)?

The formula for to make the convertion from RGB to luminance is :


   luminance = 0,299 * R + 0,587 * G + 0,114 * B

You can find more informations about this type of conversion at http://fr.wikipedia.org/wiki/YCbCr

Given the wording of your posts, either I’m not understanding you (highly likely) or your not understanding my answer.
GL_LUMINANCE makes the same channel data available across all channels during texture read. So (R,R,R,R) or R,G,B,A it does not matter as all channels are identical.

With GL_LUMINANCE, alls channels have the same replicated value, cf. RGBA = (X, X, X, 1)

My previous formula is the reverse conversion which make the conversion from a color RGB triple values to his luminance value