How to do custom subj in fragment program with filtering mode set to GL_NEAREST ?
How to do custom subj in fragment program with filtering mode set to GL_NEAREST ?
What does "subj" mean in your question?
"If you can't afford to do something right,
you'd better make sure you can afford to do it wrong!"
I think subj is an alias for the title.
You can do something quick and cheap with clamping the texcoord, then do sampling at the 4 local texels :
{x, y)
(x+1, y)
(x, y+1)
(x+1, y+1)
then do a weighted blend between the 4.
------------------------------
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
I've understood how to do it!
float OneTexel = 1.0/TextureSize;
vec2 coord1 = TexCoord0+vec2(0.0, OneTexel);
vec2 coord2 = TexCoord0+vec2(OneTexel, 0.0 );
vec2 coord3 = TexCoord0+vec2(OneTexel, OneTexel);
vec2 coord4 = TexCoord0;
vec4 s1 = vec4(texture2D(Texture0, coord1));
vec4 s2 = vec4(texture2D(Texture0, coord2));
vec4 s3 = vec4(texture2D(Texture0, coord3));
vec4 s4 = vec4(texture2D(Texture0, coord4));
vec2 Dimensions = vec2(TexCoord0) * TextureSize;
float fu = fract(Dimensions.x);
float fv = fract(Dimensions.y);
vec4 tmp1 = mix(s4, s2, fu);
vec4 tmp2 = mix(s1, s3, fu);
vec4 t0 = mix(tmp1, tmp2, fv);