Re: [Plib-users] (no subject)
Brought to you by:
sjbaker
From: steve <sjb...@ai...> - 2006-07-20 15:18:54
|
Hemalatha Sharma wrote: > > Hi, > I am mailing again. > There was no reply for my query. All four(!) copies of your email arrived simultaneously - you need to exhibit some more patience. > I need to convert from geodetic data to screen coordinates. > How can i do it? > > There is a function in SimGear(SgGeodToCart) which converts geodetic > lat,long to cartesian form. > But How do i convert from catesian to screen cartesian form. Geodetic to cartesian is definitely not a PLIB thing - so you're right to seek help in SimGear. Cartesian to screen coordinates is probably best handled by the OpenGL function 'gluProject'...so this isn't really a PLIB question either. However: GLint gluProject ( GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* winX, GLdouble* winY, GLdouble* winZ); Where: (objX, objY, objZ) is the cartesian coordinate you are concerned about. model, proj are the OpenGL modelview and projection matrix. You can either get these by doing a glGetMatrix() or inside SSG you can use ssgContext::getProjectionMatrix() and ssgContext::getModelviewMatrix(). view is an array containing the viewport parameters. You get this with glGetFloatv(GL_VIEWPORT,...). (winX, winY, winZ) are pointers to where you'd like the return results placed. |