Forums > Jitter

jit.gl.slab/shader – GLSL equivalent to "sendinput filter nearest"?

August 31, 2007 | 6:48 am

Hello

I searched through the GLSlang reference and quick guide, and it did
not appear obvious to me, but is there a way to set the filter mode
of a texture unit procedurally within a shader?

I would like to tell a shader to treat texture unit one as nearest
neighbor (or, non interpolating). (not on a per vertex or per
fragment basis, ie, changing the filter mode during texture
processing, just globally).

If not, not a big deal, but it would be nice to do it sans max code
so I know the shader will always behave as expected. Just curious

Thanks a lot!

v a d e //

http://www.vade.info
abstrakt.vade.info


August 31, 2007 | 2:48 pm

To do nearest neighbor texture sampling all you have to do is:

vec4 sample = texture2d(tex0, floor(texcoord0+vec2(0.5));

AB


August 31, 2007 | 3:18 pm

Hah. that makes perfect sense. Thanks a lot!

On Aug 31, 2007, at 10:48 AM, Andrew Benson wrote:

> To do nearest neighbor texture sampling all you have to do is:
>
> vec4 sample = texture2d(tex0, floor(texcoord0+vec2(0.5));
>
> AB

v a d e //

http://www.vade.info
abstrakt.vade.info


Viewing 3 posts - 1 through 3 (of 3 total)