Is this code right - it draws lots of stuff, either using VBOs or not using VBOs if they are not available:
gl.glEnableClientState(GL2.GL_VERTEX_ARRAY);
gl.glEnableClientState(GL2.GL_COLOR_ARRAY);
for (int i = 0; i < (layers * layers); i++) {
gl.glTranslatef(0.0f, 0.0f, 0.01f);
if (JoglRunner.vboAvailable(gl)) {
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, VBO[0]);
gl.glVertexPointer(3, GL.GL_FLOAT, 0, 0);
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, VBO[1]);
gl.glColorPointer(4, GL.GL_FLOAT, 0, 0);
gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 20000);
} else {
gl.glVertexPointer(3, GL.GL_FLOAT, 0, vertexBuffer);
gl.glColorPointer(4, GL.GL_FLOAT, 0, colorBuffer);
gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 20000);
}
}
gl.glDisableClientState(GL2.GL_VERTEX_ARRAY);
gl.glDisableClientState(GL2.GL_COLOR_ARRAY);
I’m bothered by the call to enable client state that I sem to need before using a VBO - it doesn’t make sense to me - I am trying to avoid client state.