I want to know how can I do to apply different textures to a same object.
Because I load a map in ASE Format and I want to have a texture for the wall and
a another texture for the ground and a another for the sky etc…
I am very familiar with ASE (Ascii Scene Export) Files. The issue of using a different texture with different *GEOMOBJECT is as simple as binding whichever texture you want on the object before you draw each object. As simple as…
The issue I believe at hand for you involves drawing a single object with separate parts of the object recieving separate textures. (I assume you don’t mean multitexturing). If you look at the ASE file you will see that each face of a mesh object contains a material ID. This is simply the sub material id that is assigned using any of the many methods in 3d studio max. The sub material id of each face corresponds to the sub material in a multi material material. I know it sounds sortof confusing. I am assuming you understand the way that the multiple material material works in max. The easiest way to draw objects of this type (but certainly not the most efficient way) is like this.
DrawObject(obj)
{
For M = EachMaterial
{
BindTexture(); // bind the texture for the sub material
forAllFaces
{
if(face.materialid == M)
drawface
} // end for all faces
} // end for all materials
Forgive my rather poor psuedo code. This is the basic idea. A more efficient way is to sort the faces by material. Then you save the if statement that is executed for every material for every face.
**** it…
if u have the solution tell me if not shut ur motha ****a
mouse.
thats the mail i got (you can do it officially if you want)
to your problem:
i don’t know the ase-file very well, but the help you got should be quite ok… as you know i think, you can only bind one texture at a time (per texture stage in multitexturing), so you have to call glBegin glEnd for each texture (or glDrawArrays or one of the equivalents…)