I was previously using display lists to render, and am now using VBOs, and I’m getting the same problem.
I’m getting some jumping, as in for a frame or two everything stutters/jumps to the side (generally in the direction of motion). I’m wondering if this is a lag problem, but it seems to have gotten worse since switching to VBOs, which is the opposite of what I was expecting.
I’m also getting some horizontal lines. I’m drawing textures by using a 512px x 512px image divided into 16x16 tiles. I’ve tried to fix this by drawing 1.0f/16.001f of the texture instead of just 1.0f/16.0f, and this helps, but doesn’t completely fix it. It looks like it’s still drawing a little too much of the image (1 pixel to be exact) and in a long row of tiles this causes a very noticeable horizontal line.
Does anyone have any idea what could be causing these issues?
Thanks!
Here is the code I’m using to render about 1000 polygons per frame. I’d like to eventually be able to draw many more, but I need to fix these issues first.
public void render(float scaleX, float scaleY, float scaleZ)
{
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vertex_buffer_id);
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, vertex_buffer_data, GL15.GL_STATIC_DRAW);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, GameApplet.getTilesTexture().getTextureID());
GL11.glVertexPointer(3, GL11.GL_FLOAT, 48, 0);
GL11.glNormalPointer(GL11.GL_FLOAT, 48, 12);
GL11.glColorPointer(4, GL11.GL_FLOAT, 48, 24);
GL11.glTexCoordPointer(2, GL11.GL_FLOAT, 48, 40);
GL11.glScalef(scaleX, scaleY, scaleZ);
GL11.glDrawArrays(GL11.GL_QUADS, 0, vertex_data_array.length / 12);
}