Re: [Plib-users] PLIB vs OpenGL axes
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2003-08-13 05:32:54
|
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----- |