Jump to content
  • Advertisement
Sign in to follow this  
Leaguefun

Binding textures

This topic is 5085 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

Can I bind several textures within an 3D model exported by 3DS ? I'm having an 3D model which had 2 materials with ID 1 and 2, then I export those model with my exporter associated with reading the appropriate material ID for each faces. I'm sure that this process is done with no error. After I bind texture by using glActiveTextureARB() for all materials used by the model, and using glMultiTexCoord2fARB() to specify the texture coordinates with associated material ID, but I'd found that the 2 textures had been merged together, I don't want what is problem ? [Edited by - benjamin bunny on January 10, 2005 6:01:11 PM]

Share this post


Link to post
Share on other sites
Advertisement
Blending textures together is what multitexturing is for, so I'm guessing that that's not quite what you want. If you want to render your model, then you should group your polygons by their texture and draw each set with just glBindTexture().

Share this post


Link to post
Share on other sites
Since multi-texturing method will doing some bitwise operation (AND,OR...), but how can I using partial portion from several textures to bind a single model (Let's say between a pair of glBegin() and glEnd() will be more clearly) ?

Share this post


Link to post
Share on other sites

Here is a bit of pseudo code drawing with seperate textures in immediate mode (slow):


glBegin()
for(i = 0; i < face_count; i++) {
if(face.material_id == 1) glBindTexture(texture1)
else glBindTexture(texture2)
face.draw()
}
glEnd()



You can do the same thing with vertex arrays, just sort the faces ahead of time:


glVertexPointer(vertex_data)
glNormalPointer(normal_data)
glTexCoordPointer(tex_coord_data)

glBindTexture(texture1)
glDrawElements(faces_with_texture_1)

glBindTexture(texture2)
glDrawElements(faces_with_texture_2)




Share this post


Link to post
Share on other sites
To the OP: I edited your title to something more descriptive. Please try to post something relevant in the subject line in future, it's less annoying, and you're more likely to get a helpful response.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!