Question of texture coordinates in shader

//Read texture coordinates
"vec2 texCoord = gl_TexCoord[0].xy;"
//Read value of texture of current pixel
"vec4 original_value = texture2DRect(texture,texCoord);"

The gl_TexCoord[0].xy will return the coordinates (x,y) of the texture[0] to the vec2 texCoord right?
Eg: if (x,y) = (1,2);
texCoord = (1,2) right?

Q2: I only have one component on each pixels of the texture. So, texture2DRect(texture,texCoord) will return 4 values to the original_value.
Eg: If the texture value is 2, the original_value = (2,0,0,0)?
The rest of the value will be zero or how?

One by one, you’re basically asking, “how does OpenGL work?” You should stop asking questions and start doing research. For example, the answer to both of theses questions can be found on the OpenGL Wiki.

While the OpenGL Specification can get rather technical in places, the GLSL spec is quite readable and would have answered your first question easily.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.