Booba
04-23-2002, 07:20 AM
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 :
const
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 :
BEGIN
glBindTexture( GL_TEXTURE_2D, 2);
glBegin(GL_TRIANGLE_STRIP);
glTexCoord2f(0.0,1.0); glVertex3f(-150,+25,0);
glTexCoord2f(0.0,0.0); glVertex3f(-150,-25,0);
glTexCoord2f(1.0,1.0); glVertex3f(+150,+25,0);
glTexCoord2f(1.0,0.0); glVertex3f(+150,-25,0);
glEnd;
END
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.
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 :
const
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 :
BEGIN
glBindTexture( GL_TEXTURE_2D, 2);
glBegin(GL_TRIANGLE_STRIP);
glTexCoord2f(0.0,1.0); glVertex3f(-150,+25,0);
glTexCoord2f(0.0,0.0); glVertex3f(-150,-25,0);
glTexCoord2f(1.0,1.0); glVertex3f(+150,+25,0);
glTexCoord2f(1.0,0.0); glVertex3f(+150,-25,0);
glEnd;
END
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.