# GaryNas

Member

121

134 Neutral

• Rank
Member
1. ## OpenGL What makes OpenGL right handed?

Quote:Original post by jyk Anyway, I guess my question for you would be, what in the above example indicates that clip coordinates are in a right-handed space? What should I be looking for exactly? Thanks for the great example jyk. Going through your calculations, it's clear that this confirms what you found regarding OpenGL clip space being left handed. The -1 (3,2) entry in the projection matrix is what turns the right handed system into a left handed one. To me, this thread has been a great help in simplifying OpenGL/Direct3D interoperability. To me, the only fundamental difference between the two is the z-axis of NDC space going from [-1,1] in OGL and [0,1] in D3D, and an engine that uses both renderers only has to take this difference into consideration.
2. ## OpenGL What makes OpenGL right handed?

Quote:Original post by jyk So in short, I don't see anything there that indicates that clip space is right-handed in OpenGL. Here's a test for you jyk - try running your right handed OpenGL/Direct3D engine through PIX and see what your post vertex shader values are. I'm willing to bet that they are represented in this space by a left handed system. If we could somehow use PIX with OpenGL, then I would guess they would be represented by a right handed system. It's precisely this space that I'm *guessing* makes DirectX/OpenGL left/right handed. I've just tried this using two Direct3D right handed engines and both are left handed when I look at the vertex shader output. Thoughts?
3. ## OpenGL What makes OpenGL right handed?

Quote:Original post by jyk Can you provide a link to a reference? This is the best I can do: http://www.gamerendering.com/2008/10/05/clip-space/ :(
4. ## OpenGL What makes OpenGL right handed?

Quote:Original post by jyk What leads you to believe that clip space is right-handed in OpenGL? The internet? :) For DirectX (using a left handed system), if I look at the vertex shader output in PIX, all visible vertices have a positive z value.
5. ## OpenGL What makes OpenGL right handed?

Quote: All the discussion now is about whether the API itself introduces a handedness. But since all aspects that play a role can be re-programmed or, with OpenGL's newest specifications, have to be be programmed, the consensus seems me to be that there is no real handedness in OpenGL. Instead, the handedness comes from the way an application uses the API. So saying OpenGL uses RHS is substantiated in the history where the utility functions like glFrustum and glOrtho as well as the default winding rules and depth test were used widely by applications, and those functions and defaults have done a set-up for RHS. Wow. There's been some really good discussion on this topic here. I think that jyk's mention of face culling gives us a clue. I believe that clip space (i.e. post projection space, before homogenous divide which transforms us to NDC space) is hard coded in each API to be a specific handedness. Direct3D uses a left handed clip space and OpenGL a right handed clip space. It's in this space that face culling and frustum clipping occurs. Frustum clipping is something we have no control over, so possibly at this point OpenGL expects a right handed system (i.e. looking down -z) to properly clip. Is this right?
6. ## OpenGL What makes OpenGL right handed?

Quote:Original post by cgrant The pipeline requires the data to be as such for processing..i.e internally it makes the assumption that stuff are in a right handed coordinate system. Not directly related, but APIs have to make certain assumptions, ex. that is why by default vertices in GL have to be specified counter-clockwise...thats just the way it is. Ah, this is exactly what I'm getting at. Do you know which part of the pipeline requires a right handed system? I've searched all over for this info, but all I can find is "OpenGL is right handed", "DirectX is left handed".
7. ## OpenGL What makes OpenGL right handed?

Quote:Original post by Yann L Why do some countries drive on the right and some on the left side of the road ? It's a convention. They had to pick something. Do you mean they had to pick something for the glu library, or for OpenGL? Let me give an example. Assume my models, and world are left handed. I use this left handed world in OpenGL and do not convert to a right handed system. Which part of OpenGL will have trouble with this left handed system? I believe the problem would be in clip space, but I'm not sure.
8. ## OpenGL What makes OpenGL right handed?

Quote:Original post by gtdelarosa2 Negative Z points away from the camera origin( into the screen ) and Positive Y points up, Positive X points towards the right. Yes, that's a right handed system, but what about OpenGL requires this?
9. ## OpenGL What makes OpenGL right handed?

I often hear OpenGL referred to as using a right handed coordinate system, but I'm a little unclear as to the precise reason why this is so. Sure, the gluXXX helper functions operate in a right handed system, but what specifically about OpenGL makes it right handed?
10. ## Direct3D9 with a right handed system

Quote:Original post by jyk The difference is not that one extends to positive z and the other to negative z, but rather that in OpenGL the canonical view volume extends from -1 to +1 in the z direction, while in Direct3D it extends from 0 to 1 in the z direction. I think I meant post-projection space. It's the space after projection, but before divide by w, which takes you into normalized device space (i.e. canonical view volume). It's here that the API's do culling and frustum clipping, and in Direct3D this looks down positive z and on OpenGL negative z. So yeah, this is the only part of the pipeline that I imagine would make one API left or right handed.
11. ## Direct3D9 with a right handed system

Quote:Original post by jyk DirectX/Direct3D isn't really any more left-handed than it is right-handed (at least not as I understand it). Given that the DX math library has included LH and RH versions of all the transform functions for which handedness matters for quite a while now (if I'm not mistaken), I'm not actually sure why Direct3D is still commonly thought of as being 'left handed'. I might be overlooking something though. This is what's confusing me. The DirectX documents state that DX is left handed, but it's not really clear what that means. It's the same as saying OpenGL is right handed. Yeah, the gluXXX support functions are right handed, but what specifically about OpenGL is right handed? As I mentioned, I think it's clip space that matters. DirectX clip space extends to positive z, and OpenGL extends to negative z. Am I way off here?
12. ## Using determinant for handiness

Quote:Original post by Emergent So for the purpose of handedness, the basis {(1,0,0),(0,1,0),(0,0,1)} is not the same as the basis {(0,1,0),(1,0,0),(0,0,1)}. But if someone comes up to me and says is {(1,0,0),(0,1,0),(0,0,1)} left handed or right, there's no way I can determine that, correct? It would be an arbitrary decision based on if I use my left or right hand to visualize the cross of (1,0,0) and (0,1,0).
13. ## Using determinant for handiness

I've been reading how the determinant of 3 basis vectors can be taken to determine handiness of the coordinate system. (u x v) . z > 0 == right hand (u x v) . z < 0 == left hand I'm not clear on how this works though. Say my three vectors are: [1,0,0], [0,1,0], [0,0,1]. The determinant is always 1, yet I can still use these basis vectors for either a right handed or left handed system. What am I missing?
14. ## Direct3D9 with a right handed system

In my Direct3D 9 renderer I'm starting I would like to use a right handed coordinate system, but I'm not completely clear on the steps I need to take. Am I correct in thinking that everything stays in the right handed system until projection? (e.g. I can build my camera with D3DXMatrixLookAtRH)? I guess even more fundamentally, what precisely does it mean that Direct3D 9 is "left handed"? Is it because clip space is left handed?
15. ## Cross product and coordinate systems

I'm a little confused about cross product and left/right coordinate systems. Consider these two vectors: A = {0, 0, 1} B = {1, 0, 0} Without considering coordinate systems, the cross product is {0,1,0}. Now in a left handed system, I get {0, -1, 0} following the right hand rule, but {0,1,0} using a left hand rule. This is obviously a basic question, but I'm not quite sure how to interpret this. How can I use this information to build a look at camera matrix in the two different coordinate systems? Thanks for any info.