Texturing challenge

Member
Posts: 241
Joined: 2008.07
Post: #1
I've got a train mesh that loads as one object, so I have one array to work with. I have 5 textures to apply to it in different places. There's a texture for the engine and a different texture for each of its cars. Also, there's a texture for the wheels and a second texture for the engine. Help! Annoyed
Quote this message in a reply
Member
Posts: 283
Joined: 2006.05
Post: #2
I guess it depends on what you mean by "loads as one object". How are you loading the mesh?

You could put all your textures into one image and offset the texture coordinates, or you could just have an array for each object (slightly slower but simpler).
Quote this message in a reply
Member
Posts: 241
Joined: 2008.07
Post: #3
It's a 3ds file and I have an exporter that writes all the data out to a text file in C++ code so that all I have to do is include the exported file and pass in the written array pointer to OpenGL.

The mesh is all one piece, the index array is all one array. So, it isn't broken up in any way.
Quote this message in a reply
Member
Posts: 283
Joined: 2006.05
Post: #4
Could you just export each object separately?

Otherwise you're going to have to find another exporter that supports multiple textures or start editing the C++ file that it exports (which might be fairly annoying or almost impossible depending on how it formats it).

Anyway, you're not going to be able to change texture in the middle of drawing a vertex array (AFAIK), and even if you could you'd still need a way to work out which vertices applied to each object.
Quote this message in a reply
Member
Posts: 241
Joined: 2008.07
Post: #5
That's what I thought. Thanks!
Quote this message in a reply
Post Reply