🔒 Locked
What makes OpenGL right handed?
Advertisement
Original Post
Negative Z points away from the camera origin( into the screen ) and Positive Y points up, Positive X points towards the right.
Quote:
Original post by GaryNas 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?
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.
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.
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.
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".
Quote:
Original post by GaryNas
Do you mean they had to pick something for the glu library, or for OpenGL?
glu is the OpenGL utility library, it's evident that both have to use the same conventions.
Quote:
Original post by GaryNas
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?
None at all. It will just not be displayed the way you intended it to be. Up, down, left, right, in, out - all that are human concepts. A mathematical processing framework, such as OpenGL, can't use these. You have to map these concepts of human perception to absolute mathematical terms. Just as OpenGL doesn't know what the colour red is, but it knows (1,0,0).
By supplying your own projection matrix to OpenGL, you can make it left or right handed. Or, assuming some vertex shader magic, you could even specify your points in a totally different coordinate system. Spherical polar, for example. It's all a question of conventions.
So to answer your question, there is no part of OpenGL that requires a certain handedness. Assuming we're talking about modern, non-FFP OpenGL.
The difference I see is actually in projection computation (as was already mentioned above). If you choose the view local x and y directions for spanning the view plane, and let stuff at less depth cover stuff at greater depth, then choosing whether depth increases with increasing local z or else increases with decreasing local z makes the difference. The former method would be LHS, and the latter one RHS.
Yup, it is the projection matrix. I have done some D3D and GL code where both had to be right handed. I just manipulated the projection for D3D (actually, they have D3DXPersPectiveRH) and also for modelview rotation, there is the RH versions. Translation is universal. Scale is universal.
The other thing left to do is setup culling for D3D.
The other thing left to do is setup culling for D3D.
Quote:I'm not sure it's quite that simple.
Original post by Daaark Quote:That's all you can find, because that's the entirety of it. There's nothing more to say about it.
Original post by GaryNas
I've searched all over for this info, but all I can find is "OpenGL is right handed", "DirectX is left handed".
I said this same thing in another recent thread, but as far as I can tell, Direct3D/DirectX is no more left-handed than it is right-handed. It works fine with both left- and right-handed systems (as far as I can tell, at least), and the DX math library includes transform functions for each handedness.
Why Direct3D is thought of as being left-handed, I'm not sure, but I suspect it may be historical. Maybe someone else can shed some light on this.
My guess is that OpenGL can be used with a left-handed system just as easily as Direct3D can be used with a right-handed system (as was suggested previously). I haven't actually tried this myself though, so I can't say for sure.
If that's true though, then I would think that the only thing that makes OpenGL 'right-handed' is the few convenience functions that build transforms for which handedness matters (gluLookAt, gluPerspective, etc.). If you take these out of the picture (e.g. by using glLoad/MultMatrix, or by using the programmable pipeline), then I'm not sure that OpenGL can be said to have an inherent handedness.
So to get back to the original question, my guess is that the only thing that makes OpenGL 'right-handed' is a few convenience functions that you can easily do without, and that in fact are no longer even included as part of the API. (I could be overlooking something though.)
Maybe I will tell a totally dumb thing, but I'm a bit tired.
I think that makes openGL right-handed, is that if you don't apply any transformations (identity as model-view and projection), a model made and viewed in a left handed editor would appear mirrored in onenGL in the said conditions.
Some one please clarify this.
I think that makes openGL right-handed, is that if you don't apply any transformations (identity as model-view and projection), a model made and viewed in a left handed editor would appear mirrored in onenGL in the said conditions.
Some one please clarify this.
Quote:I don't think that's right; if the projection matrix is identity, I don't think the visual output will be anything meaningful (in the general case, at least).
Original post by szecs
Maybe I will tell a totally dumb thing, but I'm a bit tired.
I think that makes openGL right-handed, is that if you don't apply any transformations (identity as model-view and projection), a model made and viewed in a left handed editor would appear mirrored in onenGL in the said conditions.
Some one please clarify this.
Quote:Sure it will. An identity projection matrix is just an unscaled orthographic projection.
Original post by jyk
if the projection matrix is identity, I don't think the visual output will be anything meaningful (in the general case, at least).
Quote:
Original post by jyk
I said this same thing in another recent thread, but as far as I can tell, Direct3D/DirectX is no more left-handed than it is right-handed.
You may be thinking about row mayor vs column mayor notation, but anyway in order to use the opposite handedness multiply your matrices by/or use this as your identity matrix:
[ 1 0 0 0 ][ 0 1 0 0 ][ 0 0 -1 0 ][ 0 0 0 1 ]
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement