hi, i am trying to generate 3 textures from 1 tga image i have loaded. i know the tga image loads fine because if i generate just 1 texture it works fine. The problem is when i try to generate more than 1 from the same image. here is my texture generating code…
int LoadGLTextures() // Load Bitmaps And Convert To Textures
{
int Status = false; // Status Indicator
// Load The Bitmap, Check For Errors.
if (LoadTGA(&texture[0], "test.tga"))
{
Status = true;
glGenTextures(3, &texture[0].texID); // Create Three Textures
// Create Nearest Filtered Texture
glBindTexture(GL_TEXTURE_2D, texture[0].texID);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);// ( NEW )
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);// ( NEW )
glTexImage2D(GL_TEXTURE_2D, 0, 3, texture[0].width, texture[0].height, 0, texture[0].type, GL_UNSIGNED_BYTE, texture[0].imageData);
// Create Linear Filtered Texture
glBindTexture(GL_TEXTURE_2D, texture[1].texID);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, 3, texture[0].width, texture[0].height, 0, texture[0].type, GL_UNSIGNED_BYTE, texture[0].imageData);
// Create MipMapped Texture
glBindTexture(GL_TEXTURE_2D, texture[2].texID);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);// ( NEW )
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, texture[0].width, texture[0].height,texture[0].type, GL_UNSIGNED_BYTE, texture[0].imageData);// ( NEW )
}
if (texture[0].imageData) // If Texture Image Exists
{
free(texture[0].imageData); // Free The Texture Image Memory
}
return Status;
}
whenever there is 3 in the glGenTexture it displays the pure white texture, however if i change the 3 to a 1 i get 2 textures and one white one! can someone please help me???
my tga loader is from lesson 33 at nehe.
Werdy666