Animating a texture.
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
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
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
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"
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"
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"
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"
You texures r probably not the right size
remeber ....
2,4,16,32,64,128
THE POWER OF 2
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"
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"
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement