glGenerateMipmapEXT vs. gluBuild2DMipmaps


Reading documentation about fbo, I have seen that we have to use the glGenerateMipmapEXT function in order to generate texture mipmap when it is rendered to with fbo.

My question is:
Is it possible to use glGenerateMipmapEXT instead of gluBuild2DMipmaps without fbo. I mean, for example can I do this with a texture created from a picture that I load from the hard drive and then, always use the glTexImage2D function (followed by glGenerateMipmapEXT when I need mipmap) ?

Thank you.

Yes you can :slight_smile:


It is possible to use glGenerateMipmapEXT on non-FBO textures, and in many cases it is even hardware accelerated.

Cool! Thank you both for these fast answers.

Just remember that gluBuild2DMipmaps always gives you 2^n sized textures independent of what size the source image has. Might be important of you try to load different sized textures on older cards.

For my new engine I don’t even use something else that glGenerateMipmapEXT to generate mipmaps. glTexParameter(GL_MIPMAPS_GENERATE) doesn’t make lot of sens to me and make the code weird with custom mipmaps.

Enjoy glGenerateMipmapEXT! :slight_smile:

Ok thanks a lot!