X-Plane Coordinates
These routines allow you to use OpenGL with X-Plane.
XPLMWorldToLocal
function
This routine translates coordinates from latitude, longitude, and altitude to local scene coordinates. Latitude and longitude are in decimal degrees, and altitude is in meters MSL (mean sea level). The XYZ coordinates are in meters in the local OpenGL coordinate system.
XPLM_API void XPLMWorldToLocal(
double inLatitude,
double inLongitude,
double inAltitude,
double * outX,
double * outY,
double * outZ
);
XPLMLocalToWorld
function
This routine translates a local coordinate triplet back into latitude, longitude, and altitude. Latitude and longitude are in decimal degrees, and altitude is in meters MSL (mean sea level). The XYZ coordinates are in meters in the local OpenGL coordinate system.
NOTE: world coordinates are less precise than local coordinates; you should try to avoid round tripping from local to world and back.
XPLM_API void XPLMLocalToWorld(
double inX,
double inY,
double inZ,
double * outLatitude,
double * outLongitude,
double * outAltitude
);