VBO Problem

Hello,

I am trying to add VBO’s in an easy sample application to test them, but I run into a problem. For some reason he draws something very strange. All I want to do, is render a cube. The application works fine with vertex arrays without the vbo’s so the buffers are correctly filled I presume then …

here I create the buffers:


int numOfVerts = 24;

            vboVertexID = generateVBOId(drawable);
            vertexBuffer.rewind();
            gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, vboVertexID);
            gl.glBufferDataARB(
                  GL.GL_ARRAY_BUFFER_ARB,
                  numOfVerts * 4 * 3,
                  vertexBuffer,
                  GL.GL_STATIC_DRAW_ARB);

and then to draw my vertices:


gl.glEnableClientState(GL.GL_VERTEX_ARRAY);
                  gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, vboVertexID);
                  gl.glVertexPointer(3, GL.GL_FLOAT, 12, this.vertexBuffer);
                  gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, 0);

so where is the problem … I already tried quite a lot of different values for the offset and things like that, but it just won’t fix my problem. My vertices are way off …

Hope someone sees the problem, or perhaps someone has also a simple working program with VBO’s which they want to send to me at kozen@pandora.be

Thanx already …

There is a VertexBufferObject demo in the jogl-demos workspace on java.net. It isn’t simple, but it does show how to correctly use VBOs.