PDA

View Full Version : Forcing a mipmap level



11-08-2003, 03:13 AM
Hi
does anyone know how to force a texture ( to which i rendered to using pbuffers ) into a specific mipmap level? I have set the following texparameters so far:
glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPM AP_LINEAR);
glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE);
glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D,GL_GENERATE_MIPMAP_S GIS,GL_TRUE);

I think that it can only work if i actually upload the mipmaps via gluBuild2dMipMaps for example. The problem is that i cant use this function since the texture is not load from a file or something but generated at runtime. I actually need to pass 3 mipmaplevels of this texture to a pixelshader. Anyone have an idea how to do this?

dawn
11-10-2003, 03:55 AM
When you use GL_GENERATE_MIPMAP_SGIS, the mipmaps will be automaticaly generated when the texture data is changed. So, it's also happening first time when you specify the pixels. You should specify the the image data with glTexImage functions. Afterwards, if u want to set to a certain mipmap level, use glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, level). Note that this level is referring to a tex stage, not a tex unit (which is good).