convert window coordinates to OpenGL coordinates

How can I do to convert my coordinates I get from the mouse into the coordinates used in my OpenGL window…

I want to add objects to another object at the point I define with a mouse click, but in an environment where one can rotate the object where I add my second object.

It works fine to convert the coordinates if I don´t rotate the first object, but if I rotate, everything goes wrong (naturaly)

Thanks in advance!!


Read up on gluUnproject. It is expressly for the purpose of converting window coordinates to object coordinates.