Re: [Plib-users] PLIB vs OpenGL axes
Brought to you by:
sjbaker
From: Ed J. <ed....@or...> - 2003-08-14 01:03:02
|
> Well, it's been a while since I answered this question! Yeah, sorry, I'm a bit behind the times. ;-) Thanks for the reply and for the history lesson. Very interesting. > So - the first thing SSG does is to push a 90 degree pitch rotation > onto the matrix stack. This handily converts from 'Flight Simulation' > coordinates to 'OpenGL coordinates' - and voila! Z is UP. So presumably, if I move everything in Plib around as if it's using OpenGL coordinates and stick a -90 degree pitch rotation right at the top of the scene-graph, then my Z-UP Plib stuff will integrate perfectly with my Y-UP terrain engine? Cheers, Ed. Steve Baker wrote: > Ed Jones wrote: > >> OK, so this is obviously a dopey newbie Plib 101 question but; >> >> What's the relationship between the axes that Plib uses and those of >> OpenGL? >> >> I'm used to OpenGL having X going left-right, Y going up-down and Z >> going in-out. This doesn't seem to be what Plib does, so why the >> difference; "Since SG is designed to work with OpenGL"? (from the docs) > > > Well, it's been a while since I answered this question! > > The reason is "Steve likes it that way" - which is perhaps an > unfortunate reason (well, it's not unfortunate for me - but that's > because I'm Steve!). > > I wrote the original version of PLIB's SSG library back when I didn't > expect anyone else to use it but me. > > I design flight simulator graphics systems - and have been doing 3D > graphics since the early 1980's...LONG before OpenGL was even thought > of. > > In flight simulation, the early systems (which were around before > computers > were invented - let alone 3D graphics) were purely two-dimensional > map viewing systems - so the X/Y coordinate system lay naturally along > the ground. When we went to 3D, it was natural to assume Z-is-up as a > convention. I've been doing flight simulation for so long that this > convention has become heavily burned into my brain. > > On the other hand, when Silicon Graphics first built their IRIS system > with IrisGL, they were going from a 2D computer screen (running something > a lot like X-windows) where the X/Y plane was naturally in the plane of > the screen. So when THEY added the third dimension, it was natural for > Z to point into the screen. OpenGL is a direct descendent of IrisGL. > > So - the first thing SSG does is to push a 90 degree pitch rotation > onto the matrix stack. This handily converts from 'Flight Simulation' > coordinates to 'OpenGL coordinates' - and voila! Z is UP. > > If I'd known when I wrote SSG that it would be used for all sorts of > stuff outside of flight simulation, I'd probably have stuck with the > OpenGL coordinate system. However, it's *FAR* too late to change now. > > So, SSG's coordinate system is: > > X is positive to the right. > Y is positive into the screen. > Z is positive up. > > Having said that - some modern flight simulators DO use Y-is-up...but > it makes very little practical difference. One additional matrix push > per frame is NEGLIGABLE in terms of performance. > > ---------------------------- Steve Baker ------------------------- > HomeEmail: <sjb...@ai...> WorkEmail: <sj...@li...> > HomePage : http://www.sjbaker.org > Projects : http://plib.sf.net http://tuxaqfh.sf.net > http://tuxkart.sf.net http://prettypoly.sf.net > -----BEGIN GEEK CODE BLOCK----- > GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E--- W+++ N o+ K? w--- !O M- > V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++ y++++ > -----END GEEK CODE BLOCK----- > > > > ------------------------------------------------------- > This SF.Net email sponsored by: Free pre-built ASP.NET sites including > Data Reports, E-commerce, Portals, and Forums are available now. > Download today and enter to win an XBOX or Visual Studio .NET. > http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users |