I have a texture of a tank, and I want to it appearance on the screen depends on its current direction, so I decided to use rotating texture functions of OpenGL. I followed some advices through Google and received unsuccessful results. Anyone can help me with this problem?
This is my render() function:
#define UP 0
#define DOWN 1
#define LEFT 2
#define RIGHT 3
void GameObject::render()
{
glBindTexture(GL_TEXTURE_2D, textureID);
glLoadIdentity();
glTranslatef((GLfloat)coord.getX(), (GLfloat)coord.getY(), 0.0f);
glDrawArrays(GL_QUADS, 0, 4);
}
glTranslate
you're calling does? There's also aglRotate
... \$\endgroup\$glRotatef((GLfloat)30.0f,0.0f,0.0f,1.0f);
and it will rotate your texture 30 degrees in clockwise direction. \$\endgroup\$