Convert X-Y co-ordinate value 2 latitude&longitude

How to convert the XY values to lattitude and longitude?

I mean to say, i have read x-y coordinate values using glutMotionFunc();


This is mostly a geographic projection question and depends on how you’re rendering “the world”.

What is OBJECT and WORLD space in your app? You can use your VIEWPORT settings along with inverse PROJECTION and VIEWING matrices to get back out to WORLD space (or the inverse MODELVIEW instead of inverse VIEWING to get back out to OBJECT space). Past there, you’ll have to map that 3D XYZ position to lat-lon based on your own app-specific knowledge.

Hint: Also, consider how much accuracy you need in your result. I suspect you’re not gonna be happy doing this math in 32-bit float…