weebull
03-09-2003, 03:34 PM
I am trying to create a skybox and make the floor texture tile. This code should work but it results in a dodgy shade of grey n no texture.
// Build A Texture From The Data
glGenTextures(1, &texture[0].texID);
glBindTexture(GL_TEXTURE_2D, texture[0].texID);
//make the texture repeat for the desert floor
if(strcmp(filename, "images/desert_dn2.tga") == 0)
{
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL _REPEAT);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL _REPEAT);
}else {
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
if (texture[0].bpp==24)
{
type=GL_RGB;
}
glTexImage2D(GL_TEXTURE_2D, 0, type, texture[0].width, texture[0].height,
0, type, GL_UNSIGNED_BYTE, texture[0].imageData);
// Build A Texture From The Data
glGenTextures(1, &texture[0].texID);
glBindTexture(GL_TEXTURE_2D, texture[0].texID);
//make the texture repeat for the desert floor
if(strcmp(filename, "images/desert_dn2.tga") == 0)
{
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL _REPEAT);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL _REPEAT);
}else {
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
if (texture[0].bpp==24)
{
type=GL_RGB;
}
glTexImage2D(GL_TEXTURE_2D, 0, type, texture[0].width, texture[0].height,
0, type, GL_UNSIGNED_BYTE, texture[0].imageData);