Original Post
I've got a "GLuint texture[6]" globally declared and in my init function I've got a "AUX_RGBImageRec *TextureImage[6]" declared. I obviously want to load in 6 different textures and then later apply them to various quads.
so I say
for( i = 0; i < 6; i++ )
{
if( TextureImage[ i ] = LoadBMP( makeFilename( fgets( buffer, 80, file ) ) ) )
{
glGenTextures( 1, &texture[ i ] );
glBindTexture( GL_TEXTURE_2D, texture[ i ] );
glTexImage2D( GL_TEXTURE_2D, 0, 3, TextureImage[ i ]->sizeX, TextureImage[ i ]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[ i ]->data );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
}
if( TextureImage[ i ] )
{
if( TextureImage[ i ]->data )
{
free( TextureImage[0]->data );
}
free( TextureImage[ i ] );
}
}
presuming this will load my 6 textures (from my text file) into texture[ i ], from 0 to 5.
It appears to, because when I am in my display function and I say "glBindTexture( GL_TEXTURE_2D, texture[0] );" or any other texture[num] it displays the right texture, BUT only if the glBindTexture() function is outside of my glBegin() - glEnd() block. If I try to glBindTexture() inside of glBegin() it automatically uses the 6th texture, no matter what value I give it.
I need to draw multiple quads, each with a different texture, in my glBegin() - glEnd() block, but it's not working...
Help?
Edited by - JodoKaast on March 3, 2002 9:44:31 PM