Skip to main content
GameDev.net gamedev.net
🔒 Locked

GL_GENERATE_MIPMAP vs gluBuild2DMipmaps

Started by Prune Jun 21, 2007 at 7:49 PM 3 replies 11.7k views
Original Post
Prune
Prune
Which one to use? What's the difference? gluBuild2DMipmaps(...) vs glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
"But who prays for Satan? Who, in eighteen centuries, has had the common humanity to pray for the one sinner that needed it most?" --Mark Twain

~~~~~~~~~~~~~~~Looking for a high-performance, easy to use, and lightweight math library? http://www.cmldev.net/ (note: I'm not associated with that project; just a user)
MARS_999
MARS_999
GL_GENERATE_MIPMAP is useful when you have dynamic textures. But the new GenerateMipmapEXT() is better to use than GL_GENERATE_MIPMAP.

gluBuild2DMipmaps() is done with your CPU vs. GPU like above to setup your mipmap chain.

If you just want to have mipmapped textures gluBuild2DMipmaps() is just fine.
Prune
Prune
I there any way to confirm that mipmapping is working when GL_GENERATE_MIPMAP is used? I get different (fail) behavior between this and gluBuild2Dmipmaps as follows:
With the gluBuild2DMipmaps function, in a program where one of the textures is with non-power-of-two dimensions (program has with alpha blending if it matters), with a Release build that texture doesn't display. With GL_GENERATE_MIPMAP it does.
"But who prays for Satan? Who, in eighteen centuries, has had the common humanity to pray for the one sinner that needed it most?" --Mark Twain

~~~~~~~~~~~~~~~Looking for a high-performance, easy to use, and lightweight math library? http://www.cmldev.net/ (note: I'm not associated with that project; just a user)
zedz
zedz
gluBuild2DMipmaps is very slow (+ buggy)

if a texture is not power of 2 sized then gluBuild2DMipmaps will first resize it so it is, i assume thats where the problem lies somehow.

to artifically see if mipmapping is working draw the texture with a high texture_lod_bias
perhaps draw the texture on a fullscreen sized polygon
+ then with a keypress cycle through the mipmap levels
MARS_999
MARS_999
If you want to use the GL_GENERATE_MIPMAP you don't use gluBuild2DMipmaps() you use glTexImage2D() and call the correct glTexParameteri() with true in it.

The above method works, and will automatically generate mipmaps for your dynamic textures for all levels above base level.

With GenerateMipmapEXT() it will generate all mipmaps above base also but when you choose to not the driver.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.