PDA

View Full Version : right handed matrices



mmm
03-16-2002, 08:49 PM
hi, do you know where can i find an implementation of matrix routines like glRotate, gluPerspective... ? i have all my own matrix routines but they are left handed. When i tried to convert them to a right handed system i get some errors i couldnt solve.

thanks
marcio

richardve
03-16-2002, 09:02 PM
Try the Code Of The Day section at flipCode (http://www.flipcode.com)

mmm
03-17-2002, 07:51 PM
thank you!
looking at flipcode, looking better at google and looking in the gl specs i could convert the routines... but only one still doesnt work: the lookat. I'd want to know how gluLookAt build its matrix because i cant build the mine using my own lookat routine! with d3d (left handed system) my lookat routine worked right: having the look/up/right vectors and the camera pos i build the correcting matrix. But with gl a cant build it (using look/up/left + pos).
Do you have any idea?

thanks
marcio

Gorg
03-17-2002, 08:34 PM
You do not need to modify all your code. You simply need to scale the coordinate system before doing any rendering.

I think you only need to scale z.





glMatrixMode(GL_MODELVIEW);

glLoadIdentity();

glScalef(1,1,-1); //turn into a right-handed coordinate system.
//render my stuff has usual.

mmm
03-18-2002, 06:39 PM
and that works right now!
thank you guys!

marcio