Skip to main content
gamedev.net
🔒 Locked

Binding textures

Started by Leaguefun 3 replies 1.1k views
Original Post
Leaguefun
Leaguefun
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]
HopeDagger
HopeDagger
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().
Leaguefun
Leaguefun
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) ?
Solias
Solias

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)



benjamin bunny
benjamin bunny
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.

Topic Locked

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

Sign in to reply to this topic.