Skip to main content
gamedev.net
🔒 Locked

coordinate systems

Started by webjeff Feb 20, 2009 at 9:09 AM 0 replies 700+ views
Original Post
webjeff
webjeff
Hello, I'm curious if the coordinate system have anything to do with the clipping or rasterizing or anything in the graphics pipeline. Another words, I create my own matricies for projection and view and world (IE not using D3DX or GLU). I also understand row vs col order, however, in memory they are the same so no extra conversion is necessary. So if I assume a left-handed coordinate system with the view matrix/projection matrix it should just run in opengl just fine without any modifications as it does in dx, right? That's what I'm seeing, but I need to know if I'm doing something wrong because it's working, lol. Or do I need to modify or invert my modelview matrix in opengl for this to work properly? Thanks Jeff.
Zipster
Zipster
Wait, you say it's working? Then don't mess with it! [grin]

But yes, you can generate all your own matrix data and plug it into D3D/OpenGL. The handedness conventions only come into play when you're using their built-in matrix functions. It turns out that OpenGL inverts the Z-axis during the projection transform (if you use its matrix functions to generate the transforms) so that -Z is out of the screen and +Z is into the screen. In other words, it ends up being left-handed like D3D, even though it was right-handed up to that point. My guess is that this is done for consistency during the rasterizaton stage, so that GL_LESS_EQUAL (sp?) can be used as the default Z-test and it "just works", however they just as easily could have kept things right-handed and done GL_GREATER_EQUAL (sp?). I could be wrong through. At the end of the day, the handedness is irrelevant so long as all your renderstates are set up correctly, most notably the Z-test.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.