Advertisement

Multitexturing...

Started by December 02, 2001 08:29 AM
3 comments, last by Melhisedek 23 years, 2 months ago
Is it possible to alter a Lesson6 code and apply two different textures to a cube ? Thanks in advance !!!
The thing is I want to have one texture applayed att the bottom, top and the right and another at right, front and back side of cube...
I used advice:
If we wanted two textures we would use GLuint texture[2] and the second texture would be stored at texture[1].

but it didn''t turn very good

I made 2

int Status=FALSE;
AUX_RGBImageRec *TextureImage[1];
memset(TextureImage,0,sizeof(void *)*1);

if(TextureImage[0]=LoadBMP("Data/joca.bmp"))
{
Status=TRUE;

glGenTextures(1, &texture[0]);
glBindTexture(GL_TEXTURE_2D,texture[0]);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); // Linear Filtering
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); // Linear Filtering

}
And I changed numers att the top to 2
GLuint texture[2];

Sometimes I get error and sometimes just a cube with 3 sides, other 3 are not showing up
Can anyone help please ???

P.S. I allways get error
at
// text 2
if (TextureImage[0]) // If Texture Exists
{
if (TextureImage[0]->data) // If Texture Image Exists
{
free(TextureImage[0]->data); // Free The Texture Image Memory
}

free(TextureImage[0]); // Free The Image Structure
}

return Status;
}

I made 2 o these too
Should numbers in
TextureImage[0] change ???
I allso have 2
GlBegin and glEnd...
Thanks in advance !!!
Advertisement
I have fixed it !!!
Hi,

On my site, I''ve a little example for using multitexturing.

========================
Leyder Dylan
http://ibelgique.ifrance.com/Slug-Production/
========================Leyder Dylan (dylan.leyder@slug-production.be.tf http://users.skynet.be/fa550206/Slug-Production/Index.htm/
Now... :/ I have a big problem... This is incredible
I have made a model and when I try to apply textures, everything changes colors and model gets dark. Textures should be gray but they are orange... I can''t fix it...
I''m desperate!
Your example didn''t help me. I''m using Borland 4.0 and can''t compile your files.
Thanks in advance !!!

This topic is closed to new replies.

Advertisement