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 have done this :
nb_texture = 4;
arr_texture : array[0…NB_TEXTURE-1] of string =
‘texture1.bmp’, //id 1
‘texture2.bmp’, //id 2
‘texture3.bmp’, //id 3
‘texture4.bmp’, //id 4
a procedure which creates the texture with this array (which works correctly =)
and for example to apply the “texture2.bmp” to a cube :
glBindTexture( GL_TEXTURE_2D, 2);
It’s works perfectly to apply only one texture to an object, but what can I do to
apply different textures to different parts of an object.
With a map in ASE I want to apply different textures to the different *GEOMOBJECT
Thank you very much.
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.
For M = EachMaterial
BindTexture(); // bind the texture for the sub material
if(face.materialid == M)
} // 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.
Let me know if this helps.
if u have the solution tell me if not shut ur motha ****a
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…)
how ase stores it, sorry i don’t know, but first: you got the answer i think yet, second: just save the mesh, at least its a textfile so it should be quite useful yet to get infos out of it…
thats his other post…
don’t get that stressy cause of this… just post it at one place… i f you don’t get the answer, move to another one and comment that you tried it…
and, not to flame you or blame you, but this question is yet existing so if you know all those forums you could find the info possibly, dunno…