Advertisement

Animating a texture.

Started by October 06, 2002 04:16 PM
7 comments, last by Data- 22 years, 4 months ago
I''m trying to animate a texture-mapped quad, much like NeHe''s Animated Face. I can load the textures, but I''m not sure how I can change them. Can anybody help me? Thankyou. Content Writer - TFMapped Reality is an illusion caused by alcohol deficiency"
Content Writer - TFMappedReality is an illusion caused by alcohol deficiency"
Hi...

No hard!!

What you must do is bind the right texture swicthing between them....

Say you have 3 texture:

GLuint tex[3]; //declare the textures

then, in the render function:

static frame := 0; //declare the var that will have the number of frames
glBindTexture(GL_TEXTURE_2D,tex[frame % 3]); //bind the right texture
DrawThings; //draw
frame += 1; //incrise frame

Hope this helps
Filami
Techno Grooves
Advertisement
Hi...

No hard!!

What you must do is bind the right texture swicthing between them....

Say you have 3 texture:

GLuint tex[3]; //declare the textures

then, in the render function:

static frame := 0; //declare the var that will have the number of frames
glBindTexture(GL_TEXTURE_2D,tex[frame % 3]); //bind the right texture
DrawThings; //draw
frame += 1; //incrise frame

Hope this helps
Filami

Techno Grooves
Techno Grooves
Thankyou, that helps a lot!

How can I decrease the speed that they change at?


Also, I have five textures loaded in an array called texture. I don''t want these all to animate though.

I tried making another array like this:

GLuint tex[2] = { texture[0], texture[1] };

When I came to draw the quad using tex[2], it was drawn white ie. with no texture.

Is there another way to do this?

Content Writer - TFMapped
Reality is an illusion caused by alcohol deficiency"
Content Writer - TFMappedReality is an illusion caused by alcohol deficiency"
tex[0] = texture[0];
tex[1] = texture[1];
tex[2] = nothing;
Thanks for that!

I tried it with tex[0] but it was still drawn white.

I tried this:

GLuint tex1 = texture[0];

GLuint tex2 = texture[2];

GLuint tex[2] = { tex1, tex2 };

and using:

glBindTexture(GL_TEXTURE_2D,tex[0]);


with no results.


Content Writer - TFMapped
Reality is an illusion caused by alcohol deficiency"
Content Writer - TFMappedReality is an illusion caused by alcohol deficiency"
Advertisement
You texures r probably not the right size

remeber ....

2,4,16,32,64,128

THE POWER OF 2
No, they are right.

They work fine like this:

glBindTexture(GL_TEXTURE_2D,texture[0]);


Content Writer - TFMapped
Reality is an illusion caused by alcohol deficiency"
Content Writer - TFMappedReality is an illusion caused by alcohol deficiency"
-What do you have at texture[0] and texture[2]?

-Don''t you want this?
GLuint tex1 = texture[0];
GLuint tex2 = texture[1];

-try to post some code!!

Filami

Techno Grooves
Techno Grooves

This topic is closed to new replies.

Advertisement