I try to manage the mipmap level of a texture by a uniform variable but I’ve some trouble with the textureLod function. The function retrieves me always the finest level of the mipmap (0).
uniform int Level;
uniform sampler2D Texture;
in vec2 TexCoord;
out vec4 FragColor;
void main()
{
FragColor = textureLod(Texture,TexCoord,Level);
}
If I use the texelFetch function instead of textureLod, I get the right result (but not interpolated of course).
Did you set the texunit’s filtering to linear_mipmap_linear?
Could it be that you just needed lod-bias instead of explicitly resetting the coordinate gradients?