Jump to content
  • Advertisement
Sign in to follow this  
mitsub

Multiple textures

This topic is 4440 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I've been doing lesson 6 and want to apply multiple textures to an object, however I am finding it tricky. I have an object and have 3 texture maps to apply to it. I want to make sure I am heading in the right direction to begin with. Is this code correct? int textureID[] = new int[3]; gl.glGenTextures(3, textureID); gl.glBindTexture(GL.GL_TEXTURE_2D, textureID[0]); gl.glBindTexture(GL.GL_TEXTURE_2D, textureID[1]); gl.glBindTexture(GL.GL_TEXTURE_2D, textureID[2]); thanks

Share this post


Link to post
Share on other sites
Advertisement
You can't just bind multiple textures one after another, in this case only the textureID[2] texture will be rendered.
you need to use the multitexture functions.

Share this post


Link to post
Share on other sites
Thanks for your reply.

My object is a head made up of
1) face
2) inner mouth
3) rest of head

It is an object exported from FaceGen.

I have 3 images to apply as textures to the different parts. I am not overlaying textures or anything so I don't think I need to use multitexture functions do I?

I could get around this by spliting the object into 3, but I think this would be a bit silly.

So at the minute I am reading in all the vertices (inc tex coords) and applying one texture map to the head object, which obviously uses the same texture map for the 3parts which make up the head.

If I stored the texture data in 3 different arrays, how could I apply 3 textures to them?

Thanks

Hope this is clear enough, if not please let me know.

Share this post


Link to post
Share on other sites
You will have to split the model into 3 parts, one way or another, since you need to know which verticles corespond to which texture. Then you would:


glBindTexture(GL_TEXTURE_2D, textureID[0]);
//reder the verticles that use texture 0
glBindTexture(GL_TEXTURE_2D, textureID[1]);
//render the verticle that use texture 1
//etc.


Alternatively, you could also make the model use a single texture, that is a combination of the 3 you use now.

Share this post


Link to post
Share on other sites
it's now a bit more clear to me.
I can see now that you don't need multitexture for this.
But you do however need to know wich polygons needs wich texture, and if you have to split it up in 3 different objects then so be it.
Personally i would merge all the teturemaps into one big one and then adjust the uv map of the head to that.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!