I’m trying to represent a sprite from a texture atlas using a quad with a 1:1 texel-to-pixel mapping, using GL_NEAREST as the filter. I’m getting occasional artifacts depending on where the sprites are being positioned (I am only using integer coordinates).
I’ve found all kinds of contradictory advice online, ranging from having to offset the vertices being drawn by 0.5, to having to offset and/or scale the texels being drawn by various amounts. Nothing seems to produce consistently accurate results.
What is the correct method in OpenGL ES to get a 1:1 texel-to-pixel mapping of a sub-rectangle of a texture onto a quad of matching dimensions, when using GL_NEAREST?