Now, what I can't work out, is there a good way to extract the 2D coordinates of a point that has been projected in 3D. This is obviously so I can line up overlays, calculate mouse coordinates etc.
So even if there is way to get OpenGL to move the overlay automatically, I'm thinking im going to need to the 2D coords back anyway. For mouse coords especially.
Any good links or advise on the whole interfacing with projection would be good.
Another thing I want to do is render an overlay in 2D and then swing is out in 3D. Which would obviously require taking the 2D coords and estimating the rotation and scaling values to place it roughly the same place using 3D methods.. if that makes sense.
The functions involved are mainly glInitNames/glPushName/glPopName/glSelectBuffer/glRendeMode/glFeedbackBuffer/gluPickMatrix. I'm sure u will find tons of tutorials doing interactive graphics with OpenGL googling these functions.
This is what I have so far. I'm using an AWT component I had already written which uses transparency and I rendered it to a BufferedImage, then converted it to OpenGL image. But the plan is to probably at least use OpenGL to render the transparent panel.
If you want to get the 3D world coordinates of a 2D point on the screen: you can use GL selection API's as Demoscene Passivist pointed out or any one of many "picking ray" solutions.
If you want to get the 2D screen coordinates of a point in 3D world space (which is what I think you want): you should be able to just transform your point using the modelview and projection matrices - which you can extract from GL or build yourself - and then multiply with the dimensions of your screen. Ask if you need any more info.
What I want to do it draw a 2D window using 2D techniques. But then when you say "close" the window, it rotates and disappears (swings away off in some direction). So you now want to start projecting this 2D plane in 3D and swing it out of view.