position for texture in opengl
Posted
by Tyzak
on Stack Overflow
See other posts from Stack Overflow
or by Tyzak
Published on 2010-05-11T18:01:02Z
Indexed on
2010/05/11
18:04 UTC
Read the original article
Hit count: 203
hello, i have a question concerning how to declare the points for a texture on a cube
to be exactly i mean the:
glTexCoord2f(x.f, y.f);
for the front side, my declaration works:
glBegin(GL_POLYGON); //Vorderseite
glNormal3f(0.0f, 0.0f, 1.0f);//normale für vorderseite
glTexCoord2f(0.0f, -1.f);
glVertex3f(-fSeitenL/2.0f,-fSeitenL/2.0f,+fSeitenL/2.0f);
glTexCoord2f(1.f, -1.f);
glVertex3f(+fSeitenL/2.0f,-fSeitenL/2.0f,+fSeitenL/2.0f);
glTexCoord2f(1.f, 0.0f);
glVertex3f(+fSeitenL/2.0f,+fSeitenL/2.0f,+fSeitenL/2.0f);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(-fSeitenL/2.0f,+fSeitenL/2.0f,+fSeitenL/2.0f);
glEnd();
but for the right side, it doesn't work, i suggest i need other parameters, for glTexCoord2f, but i don't know witch one.
glBegin(GL_POLYGON); //Rechte Seite
glNormal3f(1.0f, 0.0f, 0.0f); //normale für rechte seite
glTexCoord2f(0.0f, -1.f);
glVertex3f(+fSeitenL/2.0f,-fSeitenL/2.0f,+fSeitenL/2.0f);
glTexCoord2f(1.0f, -1.f);
glVertex3f(+fSeitenL/2.0f,-fSeitenL/2.0f,-fSeitenL/0.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex3f(+fSeitenL/2.0f,+fSeitenL/2.0f,-fSeitenL/0.0f);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(+fSeitenL/2.0f,+fSeitenL/2.0f,+fSeitenL/0.0f);
glEnd();
after all i close the "texture-declaration with"
glDisable(GL_TEXTURE_2D);
thanks in advance
© Stack Overflow or respective owner