5,321
edits
Line 20: | Line 20: | ||
However, this function is not available in WebGL 1.</code> | However, this function is not available in WebGL 1.</code> | ||
Instead you will need to set your image to have <code>gl.NEAREST</code> filtering and use <code>texture2D</code> | Instead you will need to set your image to have <code>gl.NEAREST</code> filtering and use <code>texture2D</code> | ||
<syntaxhighlight> | <syntaxhighlight lang="c"> | ||
vec4 texelFetch(int x, int y) { | vec4 texelFetch(int x, int y) { | ||
return texture2D(tDiffuse, vec2((float(x) + 0.5) / float(width), | return texture2D(tDiffuse, vec2((float(x) + 0.5) / float(width), | ||
Line 27: | Line 27: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==Usage (WebGL 2)== | ==Usage (WebGL 2)== |