Thread: [Plib-users] PLIB vs OpenGL axes
Brought to you by:
sjbaker
From: Ed J. <ed....@or...> - 2003-08-13 03:49:05
|
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) Cheers, Ed. P.S. I'm new to Plib, and this list, so be gentle with me! |
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----- |
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 |
From: Ed J. <ed....@or...> - 2003-08-13 05:58:55
|
Righty-ho. I've found the answers, from like 3 years ago, via geocrawler. Splendid. I don't suppose there's any chance of, in some future version, having #ifdef's to compile the libraries in either Z_IS_UP or Y_IS_UP modes? Or, would anyone like to suggest what I'd need to hack to make myself a custom version of the library that did this? I'm thinking, anything that uses _ssgOpenGLAxisSwapMatrix would be a good place to start, and making an unrotated camera point down negative-Z. Presumably some of the loaders will need changing too? Cheers, Ed. 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) > > Cheers, > Ed. > > P.S. I'm new to Plib, and this list, so be gentle with me! > > > > ------------------------------------------------------- > 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 |