glVertexPointer - don't understand javadoc

Hello,

I want to use vertex arrays with Jogl but I’m a little bit confused about the description of the glVertexPointer function call in the javadoc ??? :

http://download.java.net/media/jogl/builds/nightly/javadoc_public/javax/media/opengl/GL.html#glVertexPointer(int,%20int,%20int,%20long)

There is no argument given for my float array, so is it possible to use this function with float arrays and not with a FloatBuffer (like glVertex3fv)?

Another remark : why is there f.e. no function glVertex3fv without offset parameter? It would be easier to port OpenGL programs from C or C++ to Jogl. ::slight_smile: (or from an old Jogl program to the new ‘JSR-231’)

dj3hut1

float-arrays have to be copied when sent to the JNI-layer. FloatBuffers are more like pointers to specific data in RAM that the JNI-layer can refer to, zero-copy.

For efficiency reasons - and probably to force developers to do it properly - the whole float-array version of the method is removed.

At least, that’s what my common sense tells me :wink:

Riven is correct about the Buffer argument to glVertexPointer. Please see the jogl-demos source code for examples of usage of glVertexPointer via JOGL.

Adding variants without the offset parameter would cause the number of overloaded methods to increase too much. Just pass 0 everywhere for these arguments and you should be fine.

ok thank you for your help, although I’m not 100% satisfied with this solution.
Hope it will get better in next versions.

Sorry for a (maybe) dumb, certainly off topic question: Why isn’t GetPrimtiveArrayCritical used for such cases in JOGL’s JNI layer?

The answer to this is explained in the JavaOne 2002 slides linked from the JOGL home page.