Kiwaiii
06-14-2010, 11:25 AM
Hi,
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).
void main()
{
ivec2 iTexCoord = TexCoord*textureSize(Texture,Level);
FragColor = texelFetch(Texture,iTexCoord,Level);
}
Do you have any idea where I've made a mistake ?
Thank you in advance.
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).
void main()
{
ivec2 iTexCoord = TexCoord*textureSize(Texture,Level);
FragColor = texelFetch(Texture,iTexCoord,Level);
}
Do you have any idea where I've made a mistake ?
Thank you in advance.