PDA

View Full Version : texture acting different in two PCs (Windows)



deshan
04-08-2012, 10:35 PM
Hello
I have a small issue with regarding texture rendering.
I am using devil libs for loading textures to my program.
In one pc the program load the the textures and displayed fine.
But the same program in another pc, it's totally white. No texture is rendering.
Since it's the same program I am bit confused.

Please let me know if u ever faced similar kind of problem, or can some one shed some light?

For your information this is how I load textures



ilInit();

ILuint ILImage;
GLuint textureHandle;
ilGenImages(1,&ILImage);
glGenTextures(1,&textureHandle);

ilBindImage(ILImage);
ILboolean success = ilLoadImage(texturePath.c_str());

glBindTexture(GL_TEXTURE_2D, textureHandle);

// enable automatic mipmap generation
glTexParameteri(GL_TEXTURE_2D, 0x8191, GL_TRUE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);

glTexImage2D(GL_TEXTURE_2D,
0,
ilGetInteger(IL_IMAGE_BPP),
ilGetInteger(IL_IMAGE_WIDTH),
ilGetInteger(IL_IMAGE_HEIGHT),
0,
ilGetInteger(IL_IMAGE_FORMAT),
GL_UNSIGNED_BYTE,
ilGetData()
);

// release IL image
ilDeleteImages(1, &ILImage);




Thank You

BionicBytes
04-09-2012, 04:56 AM
You are making use of GL_GENERATE_MIPMAP_SGIS
Are you sure the other computer actually supports this extension?have you checked the OpenGL extension strings?
For newer OpenGL versions (GL 3.0+) you can do away with SIGS and use call glGenerateMipMap function instead.


glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
Also, it's a bit odd that you have specified linear mipmaps but opted for nearest magnification filter - i'd have expected to see GL_LINEAR