PDA

View Full Version : Mipmap questions



epsil0n
11-10-2008, 04:46 AM
Hi,
i would use gluBuild2DMipmaps to create my mipmap texture levels. I have some questions about it:

1) Is this function GPU accelerated? If no, can be the CPU a more efficient alternative?
2) If the mipmap is done by GPU how can transfer each level from the GPU to the CPU?

Thanx.

_NK47
11-10-2008, 05:24 AM
1) No. Its built on CPU and uploaded to GPU.
2) glGetTexImage()

epsil0n
11-10-2008, 05:50 AM
1,2) Yes, it's right.
Now, suppose the texture is already into the graphics memory and i want to build the mipmap. Which is the best strategy? A fragment program or transfer it on the CPU and use the gluBuld2DMimaps? (the texture is small).

Groovounet
11-10-2008, 06:55 AM
glGenerateMipmaps()
or
glTexParameter(GL_MIPMAPS_GENERATE, GL_TRUE)

I prefer the first way in any case but the first way have been added for frame buffer object because sometime you generate your texture and you need to generate the mipmaps for it. Which seams to be your senario.

The second way generates the mipmaps on the GPU too.

For my point of view gluBuild2Dmipmaps is deprecated. I could be really useful when you want your software to support old or crappy hardware, like GeForce 5 and Radeon X*** (X**** is fine!)

Xmas
11-10-2008, 07:02 AM
GL_GENERATE_MIPMAP is deprecated in OpenGL 3.0 in favour of glGenerateMipmaps().

_NK47
11-10-2008, 07:16 AM
i think building mipmaps yourself is even better. ;) you could do it in many ways from box to sync filter or some other fancy stuff. but glGenerateMipmaps() is totally sufficient today and is of course faster the doing it yourself.

epsil0n
11-10-2008, 07:18 AM
glGenerateMipmaps() is really great for me because my texture is a framebuffer.

Anyone has sample code about it?

_NK47
11-10-2008, 07:26 AM
http://www.codesampler.com

epsil0n
11-10-2008, 08:10 AM
Your search - glGenerateMipmap - did not match any documents.

Suggestions:

* Make sure all words are spelled correctly.
* Try different keywords.
* Try more general keywords.
* Try fewer keywords.

* Ask http://www.opengl.org forum :-)

_NK47
11-10-2008, 09:22 AM
i thought you need framebuffer sample. glGenerateMipmap() is self explanatory. what kindof samples you expect on that? here is mine: glGenerateMipmap(GL_TEXTURE_2D);

http://www.khronos.org/opengles/sdk/docs/man/glGenerateMipmap.xml

epsil0n
11-10-2008, 03:30 PM
I resolved with a framebuffer samples and glGenerateMipmap(GL_TEXTURE_2D).

Thanx!

Duckers
11-18-2008, 06:59 AM
To everyone struggling with glGenerateMipmapEXT on ATI:

Remember to do glEnable(GL_TEXTURE_2D) (or whatever target you are using) before calling glGenerateMipmapEXT(GL_TEXTURE_2D). Or else it doesn't work (at least not here)