This post was updated on .
Hi, all -
I'm trying to port some old-ish code, previously compiled and used in the field with both JOGL 1.1.1 and 2.0-rc5. (This is from one of the featured apps on the JOGL home page. I'm trying to dust it off and bring it up to date.) Consider the following snippet - *********************************** CurrentGL2.glEnableClientState(GL2.GL_VERTEX_ARRAY); CurrentGL2.glEnableClientState(GL2.GL_NORMAL_ARRAY); CurrentGL2.glVertexPointer(3, GL2.GL_DOUBLE, 0, VertsBuffer); CurrentGL2.glNormalPointer(GL2.GL_DOUBLE, 0, NormsBuffer); for (int t = 0; t < max; t++) { int index = t * 3; IndexBuffer.position(index); CurrentGL.glDrawElements(GL.GL_TRIANGLES, 3, GL.GL_UNSIGNED_INT, IndexBuffer); } *********************************** All buffers are rewound at the proper times, etc. - this is pretty unremarkable code, directly ported from working C++ code. And as I said, it had previously worked with the two above-mentioned versions of JOGL. So I'm trying to port this to JOGL 2.2.4, and the call to glDrawElements won't compile. It no longer wants a Buffer passed as the last parameter, but a long (an offset into the the buffer). Here's the Javadoc declaration from V1.1.1 - ********************************** public void glDrawElements(int mode, int count, int type, Buffer indices) Interface to C language function: void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices); ********************************** The current javadoc shows the declaration changed to the following - ********************************** void glDrawElements(int mode, int count, int type, long indices_buffer_offset) Entry point to C language function: void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices) ********************************* Note what has happened to the final parameter. Also note how the current version still claims to wrap the same base GL glDrawElements function, which will still want a pointer to the index array as it's 4th parameter. Note also the bug description found here - https://jogamp.org/bugzilla/show_bug.cgi?id=789 . Is it possible that glDrawElements was broken when this was fixed? So what am I missing here? I have been away from the GL scene for a while, but as far as I can tell, the underlying C function hasn't changed, so why has the JOGL wrapper? And what would be a work-around? (This code doesn't use VBO's or any other extension-based GL feature. It's a lowest common denominator app.) TIA for your time and help - |
In your codes for loop try change GL2 inherit GL2ES1CurrentGL.glDrawElements to CurrentGL2.glDrawElements http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GL2.html http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GL2ES1.html#glDrawElements%28int,%20int,%20int,%20java.nio.Buffer%29 2015-01-15 2:45 GMT+01:00 BIS [via jogamp] <[hidden email]>: Hi, all - |
Hi, Xerxes -
Outstanding! Thanks very much for taking the time to respond.
|
Administrator
|
BIS, you should have look at the Java documentation of the API:
http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/
Julien Gouesse | Personal blog | Website
|
Thanks for the link. I'm still trying to find the relevant bits of documentation in the V2.4.4 downloads. (I wish you still packaged the relevant javadocs in a separate download package.) Still getting back up to speed, you know.
Thanks again for the link. |
Administrator
|
There is no version 2.4.4 yet (January 2015). The current version is the 2.2.4. The archive of the Java documentation is here:
http://jogamp.org/deployment/jogamp-current/archive/jogamp-all-platforms.7z
Julien Gouesse | Personal blog | Website
|
Aaargh - typo. It's late. (Got it right in the text, just screwed up the topic title.) And I have that download, just haven't found the javadocs yet. Still looking. |
Administrator
|
Sorry, this is the right one:
http://jogamp.org/deployment/jogamp-current/archive/jogl-javadoc.7z
Julien Gouesse | Personal blog | Website
|
Aha!!
Right - that should fill in a few gaps. I had looked for something similar but specific to 2.2.4. Like I said, I'm still getting back up to speed with the site and where to find relevant docs. (And just Java in general. It's been a few years.) Thanks for your time and help. I appreciate it. |
Free forum by Nabble | Edit this page |