VBO is not working

hi ken,

VBO problems, i suppose this is one of the high prio points in …/jogl/doc/TODO.TXT ?

“- Fully expose ARB_vertex_buffer_object APIs.”

// simple method
public void display(final GLAutoDrawable drawable)
{
gl.glClear(GL.GL_COLOR_BUFFER_BIT);

    gl.glEnableClientState(GL.GL_VERTEX_ARRAY);
    gl.glEnableClientState(GL.GL_COLOR_ARRAY);

    gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, ids[0]);
    gl.glVertexPointer(2, GL.GL_INT, 0, (Buffer) null);

    gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, ids[1]);
    gl.glColorPointer(3, GL.GL_FLOAT, 0, (Buffer) null);


    gl.glDrawArrays(GL.GL_TRIANGLES, 0, 6); // draw everything (six vertices)

    gl.glDisableClientState(GL.GL_VERTEX_ARRAY);
    gl.glDisableClientState(GL.GL_COLOR_ARRAY);

    gl.glFlush();
}

// here ist the dump

Exception in thread “AWT-EventQueue-0” javax.media.opengl.GLException: array vertex_buffer_object must be disabled to call this method
at com.sun.opengl.impl.GLImpl.checkBufferObject(GLImpl.java:28000)
at com.sun.opengl.impl.GLImpl.checkArrayVBODisabled(GLImpl.java:28039)
at com.sun.opengl.impl.GLImpl.glVertexPointer(GLImpl.java:25295)
at glTutor.hello.VBOTest.display(VBOTest.java:151)
at com.sun.opengl.impl.GLDrawableHelper.display(GLDrawableHelper.java:77)
at javax.media.opengl.GLCanvas$DisplayAction.run(GLCanvas.java:259)
at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:128)
at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:236)
at javax.media.opengl.GLCanvas.display(GLCanvas.java:127)
at javax.media.opengl.GLCanvas.paint(GLCanvas.java:139)
at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
at sun.awt.X11.XRepaintArea.paintComponent(XRepaintArea.java:56)
at sun.awt.RepaintArea.paint(RepaintArea.java:224)
at sun.awt.X11.XComponentPeer.handleEvent(XComponentPeer.java:630)
at java.awt.Component.dispatchEventImpl(Component.java:4031)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

the complete, old jogl sample is not made by myself.
http://user.cs.tu-berlin.de/~schabby/VBOTest.java

i tested this before “javax.media.opengl.GL.*” , the older jogl version - no problem.

after i made some modifications to be compatible to JSR-231,
i run into problems.

ok - most of them are solved.
and it seems, that jogl hase made a big step!
adaptions of some of the http://nehe.gamedev.net/ samles work perfect.

vertex arrays also.

ok - my machine:
notebook, linux + radeon (1/2 year)

reguards and best code !
iface

http://gui3d.org/
http://filebee.org/

I think that with this usage of VBOs you have to specify a buffer containing the data for Vertex and Colors first and then call

gl.glTexCoordPointer ( 2, GL_FLOAT, 0, 0 );

Actually I think the problem is here:


   gl.glVertexPointer(2, GL.GL_INT, 0, (Buffer) null);

In the new version you should give a long, not a buffer reference, as offset value. Try:


   gl.glVertexPointer(2, GL.GL_INT, 0, 0);

And the same for colorpointer naturally.

100% !

thank you for fast help !

gl.glVertexPointer(2, GL.GL_INT, 0, (Buffer) null);
gl.glVertexPointer(2, GL.GL_INT, 0, 0);

VBO is working and i’m happy.

how do you know that ?

javadoc says
void glVertexPointer(int size, int type, int stride, Buffer ptr) …

Clarvoyance? No, from this forum :wink:

Besides, also from the javadoc:
http://download.java.net/media/jogl/builds/nightly/javadoc_public/javax/media/opengl/GL.html#glVertexPointer(int, int, int, long)

That document hadn’t been updated for years. I’ve cleaned up the most obvious old items including the VBO one which was implemented a long time ago.