RE: [Plib-users] OpenGL primitives
Brought to you by:
sjbaker
From: Norman V. <nh...@ca...> - 2000-06-09 02:14:08
|
Stafford Goodsell writes >Sent: Thursday, June 08, 2000 9:28 PM >To: pli...@li... >Subject: [Plib-users] OpenGL primitives > > > >Hi, > >Also, the reason i need to debug this code so intensely is >because it seems that the axes are different depending on >if you are rotating or translating... >for translating x appears to be -, y is |, and z is . (into >the screen), but for rotations, x is around |, y is around -, and z is the same. My guess is that you are confused by the difference between the coordinate systems used by SSG and OpenGL. In OpenGL Z is going in and out of the screen whereas in SSG Z is up down or Y in OpenGL To convert from SSG to OpenGL you can use the following // hack sgMat4 copy_of_ssgOpenGLAxisSwapMatrix = { { 1.0f, 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, -1.0f, 0.0f }, { 0.0f, 1.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f, 1.0f } } ; sgMat4 vm_tmp, view_mat; sgTransposeNegateMat4 ( vm_tmp, current_view.VIEW ) ; sgCopyMat4( view_mat, copy_of_ssgOpenGLAxisSwapMatrix ) ; sgPreMultMat4( view_mat, vm_tmp ) ; glLoadMatrixf( (float *)view_mat ); Nice Looking Helicopter :-)) Have you checked out FlightGear. http://www.flightgear.otg It is using SSG for the majority of its rendering and comes with source. Norman Vine |