Hi I have this weird problem:
I have a texure, it is 512x512. I draw a quad in a viewport of 512x512 like this:
glBegin(GL_QUADS);
{
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1, -1, -0.5f);
glTexCoord2f(1.0f, 0.0f); glVertex3f( 1, -1, -0.5f);
glTexCoord2f(1.0f, 1.0f); glVertex3f( 1, 1, -0.5f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(-1, 1, -0.5f);
}
glEnd();
my fragment shader:
uniform sampler2D texUnit;
void main()
{
vec2 texCoord = gl_TexCoord[0].st
vec4 c = texture2D(texUnit, texCoord);
gl_FragColor = c;
}
But the result is a quad with the color of only the first texture element at (0,0)!
Is there something wrong with my texture coordinates? Or did I miss something else?