PDA

View Full Version : Regarding mipmapping with 3d texture



mobeen
03-16-2009, 02:39 AM
Hi all,
I have enabled mipmapping on 3D textures for a simple texture slicer. I have the mipmapping working alright. What i want to do is view all the mipmap levels. I have a small quad rendered on screen that shows the current slice from the 3d texture. I use keyboard to move across the 3d stack. This is working fine. What i want to do now is to cycle through the mipmap levels? how can i do that? I have used gDebugger and it shows all of my mipmap levels along with the data contained in them. I want to do the same but how can i do that?

I have one more question about mipmapping currently i have set the min and max filter params to be

glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
If i set the max param to anything other than GL_LINEAR, the state machine reports an error. I want to know why i get this behaviour.

Thanks,
Mobeen

Abdallah DIB
03-16-2009, 07:37 AM
for magnification filter(mag filter) u have only GL_LINEAR and GL_NEAREST
for minification filter(min filter) u have :
GL_NEAREST ( point sampling)
GL_LINEAR ( bilinear sampling)
GL_NEAREST_MIPMAP_LINEAR
..
GL_LINEAR_MIPMAP_LINEAR ( trilinear sampling ) bcoz it is linear average between two binilear sampled mipmaps. this is the best filtering .
u have to know that when using mimaps its Opengl that decides wich texture map to use based on the pixel size of the object being mapped. to see the different mipmapping try change the position of ur object from the eye and u will c that OpenGL will pick for u the corresponding level .

ZbuffeR
03-16-2009, 08:06 AM
You can tweak the lod level used, check GL_TEXTURE_LOD_BIAS here :
http://www.opengl.org/sdk/docs/man/xhtml/glTexEnv.xml

BionicBytes
03-16-2009, 08:49 AM
You can use Texture LOD BIAS to display any mipmap after you've issued the glBindTexture command....

glTexEnvf( GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS,Bias );
or you can specify a 'base level' to GL:

glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, level )