Type mismatch on gluUnproject

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?

I ended up just using a DoubleBuffer object, which solved the problem.
I guess JRuby was unwrapping it and I was losing the reference.

I’ve narrowed it down a bit to this. If I replace this code…

    projMatrix = cameraProjM.asColMajor
    modelviewMatrix = cameraViewM.asColMajor

with this code…

    projMatrix = Java::double[16].new
    modelviewMatrix = Java::double[16].new

than it works fine. The S.flow docs say asColMajor returns a float[]
array instead of a double array, which is probably the problem. How
does one convert a java float array to a java double array?

http://sunflow.sourceforge.net/docs/javadoc/org/sunflow/math/Matrix4.html#asColMajor()