PDA

View Full Version : mipmapping



Neofit
03-31-2006, 02:40 PM
why

code 1:
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_NEAREST_MIPMAP_NEAREST);

code 2:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

why code 1 is faster tha code 2?
how can i do the code 2 faster?

P.s: with code 1: 76 fps
with code 2: 36 fps

Ehsan Kamrani
03-31-2006, 05:52 PM
Are you sure? Nearest filtering is faster than linear filtering.
Have you used from the function gluBuild2DMipmaps() in code 1?
-Ehsan-

Komat
03-31-2006, 06:26 PM
Mipmaping used in first case results in memory access that is more friendly to texture caches and to memory bandwith in situations where the texture is heavily minified on the screen.


Originally posted by Ehsan Kamrani:
Nearest filtering is faster than linear filtering.
For ordinary RGBA8 textures the current HW is optimized for the GL_LINEAR case so it may be at the same speed as GL_NEAREST. Some HW reads four samples used by GL_LINEAR even if GL_NEAREST is used and then simply discards three of them.

Neofit
04-01-2006, 01:23 AM
Originally posted by Ehsan Kamrani:
Are you sure? Nearest filtering is faster than linear filtering.
Have you used from the function gluBuild2DMipmaps() in code 1?
-Ehsan- yes i used gluBuild2DMipmaps()...

but the code 1 (mip mapping) don't work on my notebook, so how can i improve the speed of code 2?

jide
04-01-2006, 04:27 AM
With using a smaller image ?

dorbie
04-01-2006, 11:06 PM
MIP mapping uses smaller image versions during minification so texture memory access is much better behaved, typically there are a lot more texture cache hits and in general the access pattern is approximately contiguous. This is not an unusual result.