shader
glsl
#version 320 es
precision highp float;
in vec2 TexCoord;
out vec4 FragColor;
// texture sampler
uniform sampler2D texture_diffuse1;
uniform vec2 textureOffset;
void main()
{
vec2 position = vec2(4.0/8.0, 1.0/8.0);
vec2 size = vec2(1.0/8.0, 1.0/8.0);
// 计算1,显示清晰
vec2 uv = position + size * fract(TexCoord);
FragColor = texture(texture_diffuse1, uv);
// 计算2, 显示模糊
vec2 dx = dFdx(TexCoord);
vec2 dy = dFdy(TexCoord);
vec2 uv = position + size * fract(TexCoord);
FragColor = textureGrad(texture_diffuse1, uv, dx, dy);
}