Sign in to follow this  

Textures disappear on ATI cards with mipmaps.

This topic is 2661 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, this might not be the issue, but it's my best shot :p

Some of my players who have ATI cards report that their textures suddenly stop rendering. It's as if the entire texture disappears. Objects don't render all white (as if the texture were disabled or something), but actually disappear.

So I've done some digging and I think that it's related to mipmaps. The entire texture is getting screwed when I call one of these 2 functions. I don't know which function, but I'm pretty sure it's happening at one of these:


void ImageManager:: SharpenTexture(const GLuint& textureID, bool linearize) {
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, textureID);
if(linearize) {
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
} else {
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
}
}
void ImageManager:: SmoothTexture(const GLuint& textureID) {
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, textureID);

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
}




These functions are called every frame, wrapped around certain parts of rendering code to change how a certain texture renders. On 99% of computers it works fine. But I'm pretty sure on these ATI computers they're causing the texture to permanently disappear. What would happen if these functions were called too many times? Anything? I shouldn't think so.. but who knows. The bug also doesn't trigger until one of these two functions are called.

Finally, these are the settings I'm using when setting up my textures:



GLuint textureID, w, h;

glEnable(GL_TEXTURE_2D);
glGenTextures(1, &textureID);
glBindTexture(GL_TEXTURE_2D, textureID);

glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

//same settings for the smooth textures function above
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);

//do some more stuff.. load the texture, etc...

//and finally (probably the cause of the issue)
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, w, h, GL_RGBA, GL_UNSIGNED_BYTE, im);



Again, these settings all work fine, even on the ATI cards with the problem. It only seems that they screwup when calling those 2 functions above. Do I have to recreate the mipmaps everytime I call glTexParameteri or something?

Any insight would be greatly appreciated.

Cheers,
Ben.


Share this post


Link to post
Share on other sites

This topic is 2661 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this