Why does texture1d () in GLSL return vec4?

I am trying to use a 1D array as a lookup table in my vertex shader. Therefore when i call

texture1D(tex,gl_TexCoord[0].s);

does it return vec4? I mean, I know what he does, but what are the 4 meanings? All I want is a single value from a coordinate based texture.

+5
source share
1 answer

Since 1D texture can / have RGBA values ​​(red, green, blue, alpha). If you save 1D texture data on the red channel (GL_RED), you can access this data with:

texture1D(tex,gl_TexCoord[0].s) .r;

+3
source

All Articles