We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProcessing DevelopmentLibraries,  Tool Development › Rigid body physics with ODEjava library
Pages: 1 2 
Rigid body physics with ODEjava library (Read 9861 times)
Re: Rigid body physics with ODEjava library
Reply #15 - Sep 1st, 2006, 6:32pm
 
Cut,Copy,Paste do not appear to work in the error window
in the Processing IDE, so I'll hand-enter the error
for one of them:

"perhaps you wanted the overloaded version 'void
    glMultiMatrix(java.nio.FloatBuffer $1)' instead?"

Adding a zero worked (good news) but I don't know why.
The opengl red book specifies the argument that should
go to glMultiMatrix() as a 16 value float array. I do
not see an option for an offset as an argument. Is my
red book out of date (the pub date is 2004)?

....>>>>

Update on this message: In wading through the
javadoc for opengl, I found this:

glMultMatrixf(float[] m, int m_offset)
         Interface to C language function:

on this page:

http://download.java.net/media/jogl/builds/nightly/javadoc_public/

Welcome to incompatibility-land....
Re: Rigid body physics with ODEjava library
Reply #16 - Sep 1st, 2006, 11:44pm
 
It's just one of those things unfortunately. I'm sure there are good reasons for them to have changed it, it's not something they'll have done lightly.
JOGL API / differences between C and Java
Reply #17 - Sep 4th, 2006, 4:40pm
 
it's because the red book api is for c, and you're writing java code. the issue that's being addressed with the "offset" variable is that there's no way to provide an index into an array automatically, the way you can with c. for instance:

glMultMatrix(&blah[4]);
in c/c++ would allow you to pass the pointer to the 4th element in the array 'blah'. there's no way to reference a pointer in this manner using java, because it has no pointer math, therefore all you can do is:
glMultMatrix(blah, 4);
to do the same thing via the jogl api.

on the other hand, the floatbuffer stuff is another way of handling memory that's more efficient than passing arrays back and forth via JNI (passing data in JNI is very slow).

but if you don't like it, take it up with the JOGL developers at Sun. though they might just laugh, you'll find that the OpenGL interface to python, ruby, etc. will all differ from the c implementation as well. Wink
Re: Rigid body physics with ODEjava library
Reply #18 - Sep 4th, 2006, 9:04pm
 
the error is due to the fact that processing now uses the 'new' jogl version which handles passing pointer ( references ) differently. it is all well described in the thread Experiences of migrating from JOGL 1.1.1 to JSR231 on the jogl forum.
Re: Rigid body physics with ODEjava library
Reply #19 - Sep 4th, 2006, 9:39pm
 
Uploaded a version which works with 115.
http://v3ga.net/processing/ODEjava/Boxes_115.zip

"All GL calls where you pass in an array you need to add an extra offset parameter - 0 when refactoring" did the trick.
Re: Rigid body physics with ODEjava library
Reply #20 - Oct 30th, 2006, 7:57pm
 
Just wanted to mention that I got ODEJava working by using the files you provide in the zip.

Coupla questions:

In your example applet, why did you decide to use the gl object directly instead of just using Processing drawing functions in OPENGL mode?

Are you aware that it's possible to use the AxisAngle4f representation of a Body to set the rotation for drawing with rotateX(), rotateY(), and rotateZ(), as opposed to calling applyMatrix()?
Re: Rigid body physics with ODEjava library
Reply #21 - Nov 6th, 2006, 2:39pm
 
Hi ddf,
I just ported an example I coded with c++ (derived from one example found with ode package), using gl commands for drawing.
I was not aware of the AxisAngle4f representation, thanks for the tip.
Re: Rigid body physics with ODEjava library
Reply #22 - Nov 6th, 2006, 5:18pm
 
Even better, I found, is you can ask for the rotation as a quarternion and then use the first three values as X, Y, and Z rotation angles respectively.
Pages: 1 2