View Full Version : Rotating the camera

Ehsan Nekooee
09-04-2009, 12:25 PM
Hi people

How can I rotate a camera to look around the scene?

I checked some complicated tutorials which they made me so much confused.

I would be appreciated if you could show me the way as simple as possible.


P.S: I use Microsoft Visual c++ 2008

Ehsan Nekooee
09-05-2009, 08:36 AM
well, Still your comments are welcome guys .....

vivek vyas
09-05-2009, 11:11 AM
some times talking
i don't understand P.S.
if you are looking for camera which like ghost(go through wall)
1. download mesa3D demos library
2. Clear that you have following libraries
a.related to OpenGL(link library with dll/so)
b.related to glut32(link library with dll/so)
c.related toglu32(link library with dll/so)
3. any of the demos containing gluLookAt function
understand the ObjPos function
4. make your own source with following precaution

i) don't use glLoadIdentity(); and glMatrixMode(GL_PROJECTION); in your draw function(it might used for 2Dness I stuck with that for 2 months and no one correctly regard to that and need to understand by my self
i read mesa codes 50 times to get it)
ii) your resize function must contains glLoadidentity(); after first glMatrixMode();
iii)LookAt must under

At Last the body of code should be

// at just looking it you may not understand but after done it
// u find setting camera is of just few punch code...
//include the neccessary things gl,glu,glut

LookAt(with cameramath variables);
draw the things
resize(int ,int)
//....read_mesa_code for Angles/moves
//u know that

//I hope you read any of Mesa's demos Code so undrstand the text

watch at
The Industry's Foundation for High Performance Graphics
watch at a text box above the
Graphics(specially above phics)
it used for search word "word in box"
lis in whole opengl.org site
so you find the thread:- "camera"

Ehsan Nekooee
09-05-2009, 11:32 AM
Thanx vivek vyas

I also look for some explanations on math related things...

any comments would be appreciated

vivek vyas
09-05-2009, 11:36 AM
have you installed demos at first
anyway it is trignometric maths just three lines needed but works much i had programmed some my self demos with png images

Ehsan Nekooee
09-05-2009, 12:06 PM
Well ...
I Can work with OpenGL functions a little. I just don't know about the maths basics like Camera transformations.

The exact thing I want to know is like First Person Shooter games. When I push the left arrow kew, the camera rotates to left around Y Axis and when I push the right arrow key, vise versa.

vivek vyas
09-05-2009, 01:10 PM
no read demos Mesa lies on sf.net
and in progs/demos/tunnel.c
found calcobjpos
then see at what places it use and then mimic it.
if compile tunnel.c
u find it is look like FPS(my mean someone goes through tunnel)