Hello All
I'm currently learning GLSL, and I went through the tutorial on shaders from the OF website (great tutorial by the way). In several of the example shader programs, a texture is passed to the shader, where it comes in as a sample2DRect
.
In some of the vertex shaders, this line or a similar one is present:
uniform sampler2DRect tex0;
in vec2 texcoord;
....
void main() {
vec4 position = texture(tex0, texcoord);
...
}
What exactly does the texture()
function do? I can see that it is taking in a sampler2DRect
and vec2
as parameters and returning a vec4
, but I don't understand what it really does. Is it simply combining the 2d vector with the texture?