View Full Version : newbie question about open gl
03-09-2005, 11:53 AM
I am building rendering software that should use camera that is looking along to positive Z axis. I want to use open gl (GLUT) for display purposes. As far as i know opengl cameras are lookin along negative z-axis.
I am thinking to build all the transformation matrices inside this rendering soft, so i need good way to convert my camera transformation (positive z axis) to opengl (negative z axis)..so i would see beforehand what i am suppose to be rendering :)
Is plain z mirroring enough to my world->view matrix?
Or is there way to make opengl camera to work like mine?
03-09-2005, 03:47 PM
Here is a general overview of camera and viewing in OpenGL:
And this is a more technical explanation of the gluLookAt() function
The GLU is the OpenGL Utility library with extra functionality. The gluLookAt() function allows you to specify a location for the eye/camera, and a point of interest. So if you wanted to view along +Z, specify the origin of the camera down the -Z axis, and specify the point of interest (the direction the camera is pointed in) somewhere on the +Z side.
03-10-2005, 07:18 AM
Thanks, but i am not lookin the way to just move and point the camera in world axis, but change the axis system of the camera local space, that instead the camera is facing in -z direction in its own axis system (the z values from the camera point of view would go from 0 to -infinity. I would like to have the opposite. The camera system that is looking ( in it's own axis) to +infinity in z axis.
So in the end i want have opengl camera that, when look from the camera view, all the visible things (when you have fov less then 180 deg) would have positive z coordinates
So i quess that i need to do some extra work with the world->cameraspace matrix, but i am not sure how.
03-10-2005, 02:26 PM
Sounds like you want to shift it from a right-hand coordinate system (like OpenGL uses) to a Left-handed coordinate system (like the one DirectX uses).
Well, let's see what google can find...
Thank you for the good question.
Edit: Opps, this appears to be the question you asked but not the question you intended. Here you go:
Hope this works for you.
03-10-2005, 06:41 PM
You named my problem: to change from right to left handed coordinate. In open gl FAQ i found what i think will be good for my purposes:
OpenGL doesn't have a mode switch to change from right- to left-handed coordinates. However, you can easily obtain a left-handed coordinate system by multiplying a negative Z scale onto the ModelView matrix. For example:
glScalef (1., 1., -1.);
/* multiply view transforms as usual... */
/* multiply model transforms as usual... */
Thanks. I will have more questions coming up soon..
03-10-2005, 06:41 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.