Having problems with VBO in JOGL

I am using the last pre-JSR version of JOGL. I know, I know, I will switch soon, but because the API isn’t compatible, it isn’t totally painless. In the meantime, I am trying to call VBO as follows. The code crashes on the drawArrays call. I am passing a null in for the buffer, but as far as I understand VBO (and that’s not much) I’m not actually using the array. In the C API, it’s passed as a NULL.

public void displayGL(Viewer v) {
	GL gl = v.getGL();
	if (first) {
	xyz = new float[numVertices*3];
	genGrid(xyz);
	boolean vbo = checkIfSupported(gl, "GL_ARB_vertex_buffer_object");
	System.out.println("Checking for VBO:" + vbo);
	if (vbo) {
		bufferId = new int[1];
		gl.glGenBuffersARB(1, bufferId);
		gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, bufferId[0]);
		gl.glBufferDataARB(GL.GL_ARRAY_BUFFER_ARB, numVertices*3, xyz, GL.GL_STATIC_DRAW_ARB);
	//xyz = FloatBuffer.allocate(numVertices*3);
		xyz = null; // free local data, no longer needed
	}
	first = false;

            }
	gl.glEnableClientState(GL.GL_VERTEX_ARRAY);
	gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY);
	gl.glColor3f(0,0,0);
	gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, numVertices);

==> gl.glVertexPointer(3, GL.GL_FLOAT, 0, null);
==> gl.glDrawArrays(GL.GL_TRIANGLES, 0, bufferId[0]);
gl.glDisableClientState(GL.GL_VERTEX_ARRAY);
gl.glDisableClientState(GL.GL_TEXTURE_COORD_ARRAY);
}

Have you looked at the demos.vertexBufferObject.VertexBufferObject demo in the jogl-demos workspace?

Yes I did look at the demo.

The code below successfully detects VBO. I then try to draw the VBO data and nothing shows up.
Doing it the slow way, element by element does work.
Can someone identify what I’m doing wrong?

thanks!

private void genGrid(float[] xyz) {
	Random r = new Random();
	float dx = (float)(1.0 / numCols), dy = (float)(1.0 / numRows);
	float x,y,z,zFirst, lastZ = r.nextFloat();
	final float f = dx;
	y = 0;
	for (int i = 0, c = 0; i < numRows; i++, y += dy) {
		x = 0;
		z = zFirst = lastZ;
		for (int j = 0; j < numCols; j++, x += dx) {
			xyz[c++] = x;
			xyz[c++] = y;
			z += (r.nextFloat()-.5f) * f;
			//System.out.printf("%5.2f,%5.2f,%5.2f\n", x,y,z);
			xyz[c++] = z;
			xyz[c++] = x;
			xyz[c++] = y + dy;
			xyz[c++] = z + (r.nextFloat()-.5f)*.1f;
		}
		lastZ = zFirst;
	}
}
public void init(GL gl) {
	xyz = new float[numVertices*3*2];
	genGrid(xyz);
	boolean vbo = checkIfSupported(gl, "GL_ARB_vertex_buffer_object");
	System.out.println("Checking for VBO:" + vbo);
	if (vbo) {
		bufferId = new int[1];
		gl.glGenBuffersARB(1, bufferId);
		gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, bufferId[0]);
		gl.glBufferDataARB(GL.GL_ARRAY_BUFFER_ARB, numVertices*3, xyz, GL.GL_STATIC_DRAW_ARB);
	//xyz = FloatBuffer.allocate(numVertices*3);

		xyzBuf = ByteBuffer.allocateDirect(xyz.length*8).asFloatBuffer();
		for (int i = 0; i < xyz.length; i++)
			xyzBuf.put(i, xyz[i]);
		xyzBuf.rewind();
		//xyz = null; // free local data, no longer needed
	}
	first = false;
}
public void displayGL(Viewer v) {
	GL gl = v.getGL();
	if (first) init(gl);
	gl.glEnableClientState(GL.GL_VERTEX_ARRAY);
	gl.glColor3f(0,0,0);
	gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, numVertices*2);
	gl.glVertexPointer(3, GL.GL_FLOAT, 0, xyzBuf);
	gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, bufferId[0]);
	gl.glDisableClientState(GL.GL_VERTEX_ARRAY);

	gl.glBegin(GL.GL_TRIANGLE_STRIP);
	float r, g = 0, b;
	float dr = -1.0f/numCols, dg = 1.0f/numRows, db = 1.0f/numCols;
	for (int i = 0, c = 0; i < numRows; i++) {
		r = 1; b = 0;
		
		gl.glColor4f(0,0,0,0);
		gl.glVertex3f(xyz[c], xyz[c+1],xyz[c+2]);
		gl.glVertex3f(xyz[c+3], xyz[c+4],xyz[c+5]);
		gl.glColor4f(0,0,0,0);
		gl.glVertex3f(xyz[c], xyz[c+1],xyz[c+2]);
		gl.glVertex3f(xyz[c+3], xyz[c+4],xyz[c+5]);
		for (int j = 0; j < numCols; j++, c += 6) {
			gl.glColor4f(r, g, b,1);
			gl.glVertex3f(xyz[c], xyz[c+1],xyz[c+2]);
			gl.glVertex3f(xyz[c+3], xyz[c+4],xyz[c+5]);
			r += dr;
			b += db;
		}
		g += dg;
	}
	gl.glEnd();

}