LWJGL Forum

Programming => OpenGL => Topic started by: JediSange on November 21, 2005, 16:31:03

Title: 27 Cubes meet Mouse X and Ys, kinda?
Post by: JediSange on November 21, 2005, 16:31:03
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?
Title: 27 Cubes meet Mouse X and Ys, kinda?
Post by: CaseyB on November 21, 2005, 18:38:20
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!
Title: 27 Cubes meet Mouse X and Ys, kinda?
Post by: napier on November 22, 2005, 15:37:48
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 ;-)