View Full Version : fetching GL_LUMINANCE_ALPHA in shader

05-31-2007, 12:13 AM
hi folks, I have a 32 bit 3D texture I would like to fetch in a glsl program. the texture contains two 16 bit values, which I would like to treat separately. Is there an easy way to obtain the two values, via the channels (rgba) as shown below?

float v0 = texture3D(tex3D, texCoord).?;
float v1 = texture3D(tex3D, texCoord).?;

05-31-2007, 02:42 AM
In shader the LA texture behaves like RGBA texture.
L component copied to R,G,B, and A to A.
So you access it by .R for luminance, and .A for

05-31-2007, 02:19 PM
In some cases it may be better to access B instead of R, if the data is going through roughly the same math. In that case it may be vectorized on R300 and R420 hardware too using the natively supported .wzyx swizzle.