Results 1 to 2 of 2

Thread: animating a texture

  1. #1
    Member Contributor
    Join Date
    May 2012
    Posts
    51

    animating a texture

    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

    Code :
    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);

  2. #2
    Senior Member Regular Contributor
    Join Date
    Oct 2010
    Location
    France
    Posts
    458

    Re: animating a texture

    You can use the texture matrix as long as the transformations are linear. Otherwise you'll have to change the texture coordinates.

Similar Threads

  1. Animating Texture
    By john_connor in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-09-2017, 06:32 AM
  2. Texture not animating only shows black model
    By Johnathon332 in forum OpenGL: GLSL
    Replies: 1
    Last Post: 04-28-2013, 09:26 AM
  3. animating texture maps
    By omnivore in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 03-12-2010, 12:27 PM
  4. help on animating a bug
    By Trevor in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-11-2008, 10:01 AM
  5. Animating....
    By KeSh in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-27-2004, 10:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean