27 Cubes meet Mouse X and Ys, kinda?

Started by JediSange, November 21, 2005, 16:31:03

Previous topic - Next topic

JediSange

Well, basically I'm working on something that rotates 27 cubes around the screen.  When I right click the mouse rotation is haulted and the player can click to place a marker on the cube.  The problem is that I have no earthly idea how to translate the 3D Float points to something I can compare the X and Y with... any ideas?

CaseyB

You can either use picking, or gluProject/gluUnProject.  That's as much as I know, unfortunately!  I need to do the same kind of thing and haven't been able to get it working!

napier

Here's a simple demo that does screen/world translations:

   http://potatoland.com/code/gl/lwjgl_demoScene.zip

In GLApp_DemoScene.java, the functions mouseMove() and mouseDown() translate screen coords to world.

I wrap the gluUnproject calls in a base class function called getWorldCoordsAtScreen(), which may be helpful or annoying depending on how you like to code ;-)
penGL/Java/LWJGL demos and code: http://potatoland.org/code/gl