Calculate 2d Ortho box over 3dObject

Here’s my scene:

Now I’d like the red box to be the ‘touch to launch’ button, and surely i could hack it into place
( the ‘catapult’ box moves side-to-side ), but I’d prefer to learn how to actually get it into
place no matter how deep inside the picture the item is.

Been surfing for an answer, and my 3d math is pretty rudimentary… Found ‘Painter’s Algorithm’ as one choice, also
“You’ll need to take your world space position, pump it through the world, view and projection matrices and then apply the viewport to get the corresponding screen space coordinates for a vertex.”
Yep. Umm, what? that one went slightly over my head.

The NeHe pages refer to a function called gluProject which would seem to be what I’m looking for, but
this is not in LWJGL?

Here’s one I found for XNA


Vector3 IconOffset = Vector3.Zero;
IconOffset.Y = 100.0f;
screenSpace = GraphicsDevice.Viewport.Project(Vector3.Zero, cameraProjectionMatrix, cameraViewMatrix,Matrix.CreateTranslation(gameobject.position + IconOffset ));
// get 2D position from screenspace vector
textPosition.X = screenSpace.X;
textPosition.Y = screenSpace.Y;

anything of similar ease available on OpenGL1.1? Other clues?

fraggle, found it now in GLU, glUtilities… no worries

Have a look at this class for how to use gluProject. Disclaimer: I have only just ported this code from jogl to LWJGL (and haven’t tested it either), so i’ve probably buggered it up in the switch from arrays to buffers.