Sign in to follow this  
zny

multi texture problem.

Recommended Posts

Are you already using multitexturing?

If it is, all that's required in your case is finding the correct TexCoords if you have a piece of geometry in the place where the bomb exploded.

Else, you will probably have to create a little quad in the area which is textured with the "explosion" texture. In this case multitexturing isn't required, but it'll require an extra pass for the explosion textured quad.

Share this post


Link to post
Share on other sites
yes, now i save many quad for every explode.
because i do not want the explode disappear next frame.
so i want a better way.

i am interesting in that the 1st way you said.
how can i do it with multitexture?

Share this post


Link to post
Share on other sites
Quote:
Original post by zny
yes, now i save many quad for every explode.
because i do not want the explode disappear next frame.
so i want a better way.

i am interesting in that the 1st way you said.
how can i do it with multitexture?

From OpenGL 1.3, or earlier versions through the ARB_multitexture extension, you can use more than one "texture unit" for texturing. To use it, first check if your extension string contains "GL_ARB_multitexture". If it does, your hardware is guaranteed to have atleast 2 texture units.

The default texture unit selected is texture unit 0. Suppose you have a bound texture on texture unit 0, as usual. With multitexture, you may call:


glActiveTexture(GL_TEXTURE1); // this selects the new texture unit 1
glBindTexture(GL_TEXTURE_2D, explosion_texture); // bind explosion texture
glEnable(GL_TEXTURE_2D); // enable texturing (this state is maintained per texture unit)

// ...

// specifying texture coordinates
glMultiTexCoord2f(GL_TEXTURE0, 0.0, 0.0); // these are for your terrain texture
glMultiTexCoord2f(GL_TEXTURE1, 2.0, 3.0); // these are for your explosion texture
glVertex3f(...);


And that's it! There are plenty of tutorials on this subject on the internet, but unfortunately I couldn't find even one, so this short introduction above.

Hope this helps!

Share this post


Link to post
Share on other sites
yeah, thanks very much!!what you said is right,it help me a lot.
but..... i don't konw how to say.

you know until a bullet is exploded, nobody knows the 2nd texture's position.
so the 2nd texture's position is not static.

what i said is right?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this