Are you using OSG or OpenGL? Since you're using ECEF CS, I'm assuming you want to set things up for viewing on a spheroid.
If you're using OSG, you can do the following using OSG's EllipsoidModel class (earth instance below) to set up viewing given a position and a "look-at" location in geodetic CS. It uses your example numbers. I would have chosen an altitude of something > 0.0 to get height above ellipsoid... double geoEyeLat = 15.0; double geoEyeLon = 10.0; double alt = 0.0; double geoLookatLat = geoEyeLat + 0.01; double geoLookatLon = geoEyeLon; osg::Vec3d eye; osg::Vec3d up; osg::Vec3d lookat; earth->convertLatLongHeightToXYZ(osg::DegreesToRadians(geoEyeLat), osg::DegreesToRadians(geoEyeLon), alt, eye[0], eye[1], eye[2]); up = earth->computeLocalUpVector(eye[0], eye[1], eye[2]); earth->convertLatLongHeightToXYZ(osg::DegreesToRadians(geoLookatLat), osg::DegreesToRadians(geoLookatLon), alt, lookat[0], lookat[1], lookat[2]); osg::Matrixd t_matrix; t_matrix.makeLookAt(eye, lookat, up); view->getCamera()->setViewMatrix(t_matrix); Hope this helps... -Shayne -----Original Message----- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Pilip Rogati Sent: Thursday, June 14, 2012 5:16 AM To: osg-users@lists.openscenegraph.org Subject: [osg-users] ECEF to openGl Hi. I have a big problem. not sure this is the good place to post this, but here goes..... I am working on some aircraft simulation game... Problem for me are coordinates conversion. All my coordinates are in ECEF. I have problem setting up my camera properly and then later transforming ECEF positions of aircraft so they can be rendered correctly. can someone please tell me the right way to do it, or even better some code would be nice. for example. my camera is at lat 15, lon 10, elevation 0. i want it to look at lat 15.01, lon 10, elevation 0. I convert both of theses to ecef, so i have my cameraPosition and cameraTarget. how to convert models ecef position so i have opengl x->right, y->up, z->forward? Thank you! Cheers, Pilip ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48305#48305 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org