I need to get the location of the mouse pointer at a certain depth into the screen. I think I would need to use gluProject for this, but the only things that I can find call GLU.gluProject(float, float, float, DoubleBuffer, DoubleBuffer, IntBuffer, DoubleBuffer)
but this is apparently old becuase now it seems to require GLU.gluProject(float, float, float, float[][], float[][], int[], float[])
First is this what I need and second how do I get the data that it needs to get the points that I need?
-=EDIT=-
What I am trying to accomplish is I want the name of an object to be displayed when the mouse is over it. Is this even the right track?
project and unproject can convert world space to screen and vice versa. You need to supply the modelview and perspective matrices and the viewport. To go from screen to world space you need to supply a Z depth as well since the screen is flat.
I have functions that call project/unproject with all necessary data:
http://potatoland.org/code/gl/GLApp.java
look for "unproject". Also "getWorldCoordsAtScreen()" is a handy function that I use for find world coords at screen positions.
Is it possible to do picking in an AWTGLCanvas? I kept running into a null pointer exception so I looked at the source for GL11 in the debugger and it's choking on line 1153long function_pointer = GLContext.getCapabilities().GL11_glGetFloatv_pointer;
It saysbinding == null for GL11_glGetFloatv_pointer
field access attempt on null object @ GLContext.getCapabilities().GL11_glGetFloatv_pointer
What's the deal? Am I doing something wrong?! (Quite possible as I have no idea how this stuff works yet!)
Hi CaseyB,
With regard to your original post, there was a thread on javagaming.org recently about un-projection that might help:
http://192.18.37.44/forums/index.php?topic=10970.15
(Don't know anything about AWTGLCanvas, sorry ;))
Thank you very much!!