OpenGL 2D Rasterization Sub-Pixel Translations
Posted
by
Armin Ronacher
on Game Development
See other posts from Game Development
or by Armin Ronacher
Published on 2011-04-13T08:05:08Z
Indexed on
2013/10/18
4:16 UTC
Read the original article
Hit count: 277
I have a tile based 2D engine where the projection matrix is an orthographic view of the world without any scaling applied. Thus: one pixel texture is drawn on the screen in the same size.
That all works well and looks nice but if the camera makes a sub-pixel movement small lines appear between the tiles. I can tell you in advance what does not fix the problem:
GL_NEAREST
texture interpolationGL_CLAMP_TO_EDGE
What does “fix” the problem is anchoring the camera to the nearest pixel instead of doing a sub-pixel translation. I can live with that, but the camera movement becomes jerky. Any ideas how to fix that problem without resorting to the rounding trick I do currently?
© Game Development or respective owner