When drawing OpenGL ES textures, they seem to "snap" to round pixel locations, as though the draw location was being rounded. ie. drawing at (x:1.1, y:5.4) actually draws at (x:1, y:5). This causes the textures to appear to "jump" when scrolling, rather than move smoothly.
Yes, I'm using floating point types for my vertices, etc.
Drawing lines, etc. works fine with non-round locations.
There are only two factors in the texture's location:
translation of the viewport:
glTranslatef(viewWidth/2.0f, viewHeight/2.0f, 0.0f);
The draw location:
glVertexPointer(...); // see below
I'm using the following code to draw the texture:
glTranslatef(scrollX, scrollY, 0.0f);
...
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
// Overlay map.
glTexCoordPointer(2, GL_FLOAT, 0, textureSTs);
glBindTexture(GL_TEXTURE_2D, texture.glTtextureKeyD);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
GLfloat vertices[] = {
x1, y2,
x1, y1,
x2, y1,
x2, y2,
};
glVertexPointer(2, GL_FLOAT, 0, vertices);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
Am I missing something?