Skip to main content
gamedev.net
🔒 Locked

multi texture problem.

Started by zny Apr 23, 2006 at 2:45 AM 8 replies 1.3k views
Original Post
zny
zny
hi guys, i am working at a terrain edit program. i want to make some grass texture or other texture on some place, how can i do it?
Boder
Boder
If you want to "fade" from one texture to another, I think you want 3D textures.

Check the Game Programming Wiki (gpwiki.org) they have a nice article
zny
zny
indeed, what i want is very sample.
for example, i have a bomb exploded somewhere, i want to a texture on there.
how can i do it?
deavik
deavik
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.
zny
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?
deavik
deavik
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 1glBindTexture(GL_TEXTURE_2D, explosion_texture); // bind explosion textureglEnable(GL_TEXTURE_2D); // enable texturing (this state is maintained per texture unit)// ...// specifying texture coordinatesglMultiTexCoord2f(GL_TEXTURE0, 0.0, 0.0); // these are for your terrain textureglMultiTexCoord2f(GL_TEXTURE1, 2.0, 3.0); // these are for your explosion textureglVertex3f(...);


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!
zny
zny
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?
dawidjoubert
dawidjoubert
try http://spy.nodespace.net/ and check my terrain engine, it uses the design you want.

Multitexturing fading, so you have grass and cliffs and stuff
----------------------------http://djoubert.co.uk
zny
zny
many thanks!

i have download the Stretch, but i can not find any cpp files or lib files,
could you tell me how did you do it?
zny
zny
yeah, i have found a sample method,

use glTexSubImage2D() can slove this problem easy,

and it works very good!

thanks so many people help me!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.