tseval

glGenerateMipmapEXT crashes with FBO's

Discussion created by tseval on Jun 3, 2009
ATI cards seem to crash every time I call glGenerateMipmapEXT when setting up an FBO

 

Hi folks,

I have a weird crash problem on
certain ATI cards. It seems to happen when I call glGenerateMipmapsEXT
in the setup of the FBO to establish a set of mipmaps in the buffer.

I don't have an ATI card myself, but I have got several reports from
users of our software about this problem and I have been able to trace
the problem to the glGenerateMipmapsEXT call.

Here is the FBO setup code:


******

// create objects
glGenFramebuffersEXT(1, &fb_); // Frame buffer object
glGenTextures(1, &handle_); // Texture handle
if(z_depth_ > 0)
glGenRenderbuffersEXT(1, &fb_depth_buf_); // Render buffer for z buffering

// Make frame buffer active
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb_);

// Initialize texture
glBindTexture(GL_TEXTURE_2D, handle_);

// Use CLAMP_TO_EDGE instead of CLAMP to avoid black borders on ATI cards.
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy_);

// Calculate max mipmap level. Crashes on non-square textures if this
// isn't specified.
int mm_level = ilog2(std::min(width_, height_));
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, mm_level);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width_, height_, 0, GL_RGB, GL_UNSIGNED_BYTE, (GLvoid*)NULL);

glEnable(GL_TEXTURE_2D); // just to be sure...
// Crashes here on ATI cards
glGenerateMipmapEXT(GL_TEXTURE_2D);

// Attach texture to framebuffer color buffer
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, handle_, 0);

*****

This is driving me nuts...

any ideas?

Cheers


Outcomes