How do GL_TEXTURE_MIN_LOD
, GL_TEXTURE_MAX_LOD
and LOD_BIAS
work?
To check it visually, i have created 6*6 texture with mipmapping and for values > 0.5 for MIN_LOD
I get a 3*3 texture irrespective of values for MAX_LOD
. If I change LOD_BIAS
it does not affect my o/p. I am not able to figure out how it works exactly.
Can anyone explain it by stating an example?
Edit: I am creating mipmap levels manually so that I can observe which level it is picking up. Here is my code:
glTexImage2D(target, 0, GL_RGBA,9 ,9, 0, GL_RGBA, GL_BYTE,subpix);
glTexImage2D(target, 1, GL_RGBA,4 ,4, 0, GL_RGBA, GL_BYTE,&subpix[4]);
glTexImage2D(target, 2, GL_RGBA,2 ,2, 0, GL_RGBA, GL_BYTE,&subpix[10]);
glTexImage2D(target, 3, GL_RGBA,1 ,1, 0, GL_RGBA, GL_BYTE,&subpix[18]);
glSamplerParameterf(sampler,GL_TEXTURE_MIN_LOD,0.862);
glSamplerParameterf(sampler,GL_TEXTURE_MAX_LOD,0.99);
glSamplerParameterf(sampler,GL_TEXTURE_LOD_BIAS,0.0);
In this case I am expecting it would take 2nd mipmap level which is of 2*2 but It chooses 1st mipmap level of 4*4. When I set min lod < 0.5, It takes 0th level of 9*9. And it this happens irrespective of the value set to max lod.