PDA

View Full Version : FBO: glGenerateMipmapEXT -ATI



bonzaj
07-23-2005, 03:33 AM
hello!

first of all to openGL driver team at ATI: great work with the FBO!

but...

I don't know how to generate mipmaps. Can someone tell me why the SGIS extension doesn't work anymore?
Moreover glGenerateMipmapEXT doesn't work or I just don't know how to use it. I was trying to write sth like this:


glGenFramebuffersEXT(1, &framebuffer);

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebuffer);

for(unsigned int i=1;i<numberOfTextures;i++)
{
glGenTextures(1, &amp;textures[i]);

// initialize color texture
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, textures[i]);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, texWrapS);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, texWrapT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, texMagFilter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, texMinFilter);

// glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, texWidth, texHeight, 0, GL_RGB, GL_INT, NULL);

//ok here it is
glGenerateMipma pEXT(GL_TEXTURE_2D);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
GL_COLOR_ATTACHMENT0_EXT,
GL_TEXTURE_2D, textures[i], 0);

checkFramebufferStatus();

glBindTexture(GL_TEXTURE_2D,mainTexture);
//draw here
glDisable(GL_TEXTURE_2D);
}
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glDeleteFramebuffersEXT(1, &amp;framebuffer);please help!

Dirk
07-23-2005, 07:42 AM
My understanding is (but I've never tried it), that glGenerateMipmapEXT() is an actual function that will generate mipmaps for the current texture, i.e. you have to call it after you've rendered the image.

Hope it helps

bonzaj
07-23-2005, 09:29 AM
unfortunetely it does not help. I was trying to write exactly like in spec attached example, and it does not work on ATI (I didn't checked it on NV yet).

Humus
07-26-2005, 03:19 PM
This functionality may not be included in the build in the 5.7 drivers (haven't tested myself), but it should appear in a future driver. And yes, you call it when you want to create the mipmap chain after rendering to the texture, not as a part of the init code like in GL_SGIS_generate_mipmap.

bonzaj
07-27-2005, 02:42 AM
nice :) - no problem I'll wait then. Fortunetely I'm using FBO only for preprocessing now, so I can generate mipmaps "by hand".

PsychoLns
08-01-2005, 03:23 AM
Had the same problem with 5.7, but it's completely fixed in the developer betas :)

I was able to work around it by using the old generate mipmap extension and then (which is according to the new spec in the fbo doc) use a 0*0 (or was it 1*1 don't have src here) pixel area update to the texture using CopySubTexImage to trigger the generation after each rendering. This method also works on nvidia btw. (and used in flight666 :)