I’m very new to jruby (and ruby in general), so I’m hitting a small
snag I was hoping someone could explain to me before I do something
silly. I’m trying to call gluUnproject, which takes a variety of java
arrays and returns a value. However, I’m getting the following error,
where the code I’m passing it looks to be jruby float arrays instead
of java arrays.
fo] enum_for
[error] QtJambi: Exception pending in native code in file
‘…/cpp/com_trolltech_qt_opengl/qtjambishell_QGLWidget.cpp’:1054
[error] Exception in thread “main” :29:in `mousePress’: no
gluUnProject with arguments matching [class org.jruby.RubyFloat, class
org.jruby.RubyFloat, class org.jruby.RubyFloat, class
org.jruby.java.proxies.ArrayJavaProxy, class org.jruby.RubyFixnum,
class org.jruby.java.proxies.ArrayJavaProxy, class
org.jruby.RubyFixnum, class org.jruby.java.proxies.ArrayJavaProxy,
class org.jruby.RubyFixnum, class
org.jruby.java.proxies.ArrayJavaProxy, class org.jruby.RubyFixnum] on
object #Java::JavaxMediaOpenglGlu::GLU:0xf44031 (NameError)
Here’s the docs for gluUnproject
http://download.java.net/media/jogl/jogl-2.x-docs/javax/media/opengl/glu/GLU.html#gluUnProject(double,%20double,%20double,%20double[],%20int,%20double[],%20int,%20int[],%20int,%20double[],%20int)
And I’m passing it four arrays for the following parameters
model: a java float array returned from a Sunflow Matrix4 object
proj: a java float array returned from a Sunflow Matrix4 object
a Java::int array, I make and fill myself
a Java::double array, I make myself
And here’s the docs for the function that returns the float arrays
from the Matrix4
http://sunflow.sourceforge.net/docs/javadoc/org/sunflow/math/Matrix4.html#asColMajor()
How can I condition my inputs to gluUnproject, so the function is
correctly recognized?