PDA

View Full Version : animating a texture



blessman11
03-06-2011, 12:42 PM
How can a texture be animated without having to draw the polygon again, each time you want to change the UV coordinates?

From this point, where can I go after I've


glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, MyTextureID);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glNormal3f(0.0f,0.0f,1.0f);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);glVertex3f(0.0f, 0.0f, 0.0f);
glTexCoord2f(1.0f, 0.0f);glVertex3f(600.0f, 0.0f, 0.0f);
glTexCoord2f(1.0f, 1.0f);glVertex3f(600.0f, 337.0f, 0.0f);
glTexCoord2f(0.0f, 1.0f);glVertex3f(0.0f,337.0f, 0.0f);

_arts_
03-06-2011, 01:38 PM
You can use the texture matrix as long as the transformations are linear. Otherwise you'll have to change the texture coordinates.