I hope it’s a design problem! Here’s a couple of code snippets…
I’m rendering some terrain. I set up the vertex/colour/normal arrays (which I can render without VBOs at quite high speed), then I bind these to VBOs. The render method renders portions of the arrays simply using glDrawArrays().
I’ve included some of the actual numbers. Essentially I have a terrain grid that’s 400x400 (stored in vertex arrays or VBOs) and I’m rendering a 200x200 section. Vertices are stored as ints, colours as ubytes and normals as floats.
This is the setup (done once only).
int[] vboIds = new int[3];
gl.glGenBuffers(3,vboIds,0);
_vertexBufferIndex = vboIds[0];
gl.glBindBuffer(GL.GL_ARRAY_BUFFER,_vertexBufferIndex);
gl.glBufferData(GL.GL_ARRAY_BUFFER,
_vertexByteSize, // 3849600
_vertexArray,
GL.GL_STATIC_DRAW);
gl.glVertexPointer(3,GL.GL_INT,0,0);
_colourBufferIndex = vboIds[1];
gl.glBindBuffer(GL.GL_ARRAY_BUFFER,_colourBufferIndex);
gl.glBufferData(GL.GL_ARRAY_BUFFER,
_colourByteSize, // 962400
_colourArray,
GL.GL_STATIC_DRAW);
gl.glColorPointer(3,GL.GL_UNSIGNED_BYTE,0,0);
_normalBufferIndex = vboIds[2];
gl.glBindBuffer(GL.GL_ARRAY_BUFFER,_normalBufferIndex);
gl.glBufferData(GL.GL_ARRAY_BUFFER,
_normalByteSize, // 3849600
_normalArray,
GL.GL_STATIC_DRAW);
gl.glNormalPointer(GL.GL_FLOAT,0,0);
gl.glBindBuffer(GL.GL_ARRAY_BUFFER,0);
If I just want to use vertex arrays, this is the setup I use instead.
gl.glVertexPointer(3,GL.GL_INT,0,_vertexArray);
gl.glColorPointer(3,GL.GL_UNSIGNED_BYTE,0,_colourArray);
gl.glNormalPointer(GL.GL_FLOAT,0,_normalArray);
This is the rendering section (called once per frame).
The same code works with vertex arrays and VBOs.
for(int j=0;j<h;j++) // h=200
{
gl.glDrawArrays(GL.GL_TRIANGLE_STRIP,
(802*(y+j))+(x*2), // y=0, x=0
(w+1)*2); // w=200
}
I can’t test on the RX600 at this moment in time, but I just tested on a GF6800 GT. With vertex arrays I get a frame rate of about 32 fps, with VBOs it is about 29 fps. The problem is much more pronounced on the RX600, I’ll post some figures for this later.
Any input greatly appreciated!