Re: [Plib-users] Why is z and y swapped?
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2004-09-01 17:59:21
|
Peter Poulsen wrote: > Out of pure curiosity, why is the z-axis and y-axis swapped (at least in > ssg) compared to OpenGL? (It's not true to say that SSG swaps Y and Z - it rotates the axis system through 90 degrees - the handedness of the coordinate system isn't changed as it would be if Y and Z were simply swapped.) It's that way because I wrote it. I design software for flight simulator graphics in my day job. We were doing 3D graphics 20 years ago before OpenGL (or even IrisGL from which it's descended). In the early days of flight simulation, we'd use scrolling maps to track the aircraft's flight path. Things in this world were entirely two dimensional and it was natural to use X and Y for those two dimensions...hence, when we were able to add a third dimension, it was completely natural for that to become Z. In the early days of Silicon Graphics, they already had 2D graphics displays where X and Y were the screen axes - and it was perfectly natural for THEM to make Z be the new third axis - so Z points out of the screen. Hence OpenGL's conventions follow a different history than thoe in flight simulation. Since I work in those coordinates all day long, it was natural for SSG to come out that way. SSG wasn't originally written for public consumption - I wrote it for my first 3D game 'Tux the Penguin - A Quest for Herring' - so I only had to make things convenient for me! That's the reason - and it's too hard to change it now. However, if it bothers you, you can trivially put a 90 degree pitch angle on your camera and everything will be back like OpenGL. Technically, OpenGL doesn't say anything about which way is 'up'. It only says that Y is up when everything is transformed into camera coordinates. SSG doesn't do anything in camera coordinates - so in a sense, that's a meaningless distinction. ---------------------------- 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----- |