Left Handed Matrix to Right Handed..
Hi there !
I''m working on an implementation independent 3D Camera, which returns a View Matrix which can be applied to the Scene.
Now sience OpenGL has a Right Handed Coordinate-System, I''m searching a way to transform a Left Handed Matrix into a Right Handed.
I''ve tried a matrix[3][3]*=-1 but this gets a very crazy result, which is not correct.
is there a matrix which can be multiplied by a left handed matrix to get a right handed one ?
or are there other ways to achieve this ?
Thanks in advance!
Kind regards
hansi pirman
I am a signature virus. Please add me to your signature so that I may multiply... Resistance is futile.
Hi
As I know, transposing a matrix interchanges the rows and columns in the matrix.
But my problem is the Z Value.
A Positive Z value has a different meaning in a Left Handed and a Right Handed Coordinate System.
I actually want to swap the Z value of the left handed Matrix (*=-1) so that it works for opengl (right handed coordinate system).
Thanks in advance
regards
hansi pirman
As I know, transposing a matrix interchanges the rows and columns in the matrix.
But my problem is the Z Value.
A Positive Z value has a different meaning in a Left Handed and a Right Handed Coordinate System.
I actually want to swap the Z value of the left handed Matrix (*=-1) so that it works for opengl (right handed coordinate system).
Thanks in advance
regards
hansi pirman
I am a signature virus. Please add me to your signature so that I may multiply... Resistance is futile.
Try a diagonal matrix with [1,1,-1,1] on the diagonal.
Keys to success: Ability, ambition and opportunity.
November 17, 2002 12:39 PM
h = ftan(fov * 0.5f);
w = h * aspectRatio;
zn = near clip
zf = far clip
matrix = /1/w, 0, 0, 0 \
| 0, 1/h, 0, 0 |
| 0, 0, zf/(zn-zf), -1 |
\ 0, 0, zn*zf/(zn-zf), 0 /
This is row major - transpose for column major (GL)
w = h * aspectRatio;
zn = near clip
zf = far clip
matrix = /1/w, 0, 0, 0 \
| 0, 1/h, 0, 0 |
| 0, 0, zf/(zn-zf), -1 |
\ 0, 0, zn*zf/(zn-zf), 0 /
This is row major - transpose for column major (GL)
THanks for all the answers again !
@LilBudyWizer:
I tried this. For the movement and all rotation you solution works perfectli. But the whole scene is messed up now.
i see the backsides of all polygons and the front sides are invisible... ??? any idea ?
@Anonymous Poster:
I can follow you explainations, sorry.. (im not so good in all this game math..)
But it looks like you''ve posted a Perspective Matrix..??
but i''m applying my camere to the modelview matrix ...
kind regards
hansi priman
@LilBudyWizer:
I tried this. For the movement and all rotation you solution works perfectli. But the whole scene is messed up now.
i see the backsides of all polygons and the front sides are invisible... ??? any idea ?
@Anonymous Poster:
I can follow you explainations, sorry.. (im not so good in all this game math..)
But it looks like you''ve posted a Perspective Matrix..??
but i''m applying my camere to the modelview matrix ...
kind regards
hansi priman
I am a signature virus. Please add me to your signature so that I may multiply... Resistance is futile.
November 17, 2002 01:34 PM
Right handed systems need to cull the polygons the opposite way to a left handed system.
well, it works fine now !
I use LilBudyWizer''s Method, and Anonymous Poster was also right, i had to change the vertex order!
thanks very much !
After searching the Net again, i also found LilBudyWizer''s solution at the oficial OpenGL FAQ:
(http://www.opengl.org/developers/faqs/technical/transformations.htm)
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();
glScalef (1., 1., -1.);
/* multiply view transforms as usual... */
/* multiply model transforms as usual... */
I now have to give attention to only invert the matrix once !
kind regards
hansi pirman
I use LilBudyWizer''s Method, and Anonymous Poster was also right, i had to change the vertex order!
thanks very much !
After searching the Net again, i also found LilBudyWizer''s solution at the oficial OpenGL FAQ:
(http://www.opengl.org/developers/faqs/technical/transformations.htm)
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();
glScalef (1., 1., -1.);
/* multiply view transforms as usual... */
/* multiply model transforms as usual... */
I now have to give attention to only invert the matrix once !

kind regards
hansi pirman
I am a signature virus. Please add me to your signature so that I may multiply... Resistance is futile.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement