   Amateaur Camera  problem
  Hi,I am trying to build a camera in openGL. I realized that gluLookAt() is a good thing to use and wnna use it. So i am storing 3 things in the camera... its position, its UP vector and the point at which it is looking. Now initially it is at (0,0,8) looking at a cube drawn at (0,0,0) and up vector is (0,1,0) . Now i want to rotate around the cube when the user moves the mouse in Y direction. As the camera will keep looking at the cube the LookAt position doesnt change(?) , the position is changing in following fashion float Y = m_camera.Position.Y ;float Z = m_camera.Position.Z ;Y = (float)(Y*Math.Cos(xRot) - Z*Math.Sin(xRot));Z = (float)(Y*Math.Sin(xRot) + Z*Math.Cos(xRot));m_camera.Position.Y = Y;m_camera.Position.Z = Y;but how do i get the new up vector?? thats what is really troubling. I am bad at maths and so have been studying many things online. Wanted some help from u all in solving this problem. thank you.mishal   
  u dont need to change it, just keep it (0,1,0)   ;  no actually i am rotation around the abject ( thts what i want to do), so my camera's up vector will change rite? i will try what u said but dont think it will work. Thanx for the reply :);  The up vector won't change unless you are flipping over, or pitching.  As in, if you look up, unless you see the floor, the up vector won't change.  Don't take that last one literally, but it gives an idea.  The up vector points up, according to what you see when you look up, however you are rotated.  For example, in DOOM and most other FPS games, the up vector never changed, simply because up never changed, though your looking at and actual position did.  In games like descent and forsaken 64, the up vector changed because the camera actually did flips.  Think like this, you are looking at said cube.  Now you move to the other side of the cube, looking now at where you started, from the other side of the cube.  The only vector that needed to change was the position because the forward, the lookat vector was still the cube, and the up is still the same.   ;  ya but actually its important that i be able to go under the cube such that the bottom of the cube might become my "infront" . But i got wahat u were saying. But what i realize is that want to go under the cube such that it looks like i am rotating the cube. Basically i want to rotate the cube but without keeping track of degrees rotated and such stuf in the camera. I want to only be concerned about the camera's position and orientation as if there was a cube hanging in the air and i was going all around, and under it with my camera but in such a way that the camera goes around the cube in a sphere around it. always pointing at the cube .... the cube will always be my front. and when i think abt it this wa i feel my up vector should change. I tried not changin the up vector and it felt like the cube just gets tilted y some fixed angle and then as i move the mouse it flied past me...still fighting dude ;)thnxbye   ;  You can recompute a new up vector using the old up vector. Like this:vector global_up = old_up;    vector right = cross_product( at, global_up );    new_up = normalize( cross_product( right, at ); Now, this will work ok for small changes in direction, but large changes in direction will cause the camera rotate strangely or worse. The only way to avoid that would be to make global_up a constant with the value (0,1,0), and never allow the camera to look straight up or down.   ;  Okey i will try this right now :)and let u know what happens.(feelin very sleepy but 2 messed up 2 sleep);  okey i tried smthingfloat X = m_camera.Position.X - m_camera.Target.X;Z = m_camera.Position.Z - m_camera.Target.Z;float dist = m_camera.Position.DistanceTo(m_camera.Target);Y = (float)(m_camera.Position.Y + dist*Math.Sin(xRot + Math.PI/2.0)); m_camera.WorldUp = new Vector4f(X , Y , Z , 0.0f);and it got me somewhere but not correct place :) i am rotationg but it gets closer and closer to the cube for some reason .... never cumin back no matter what...and also the cube's rotation direction changes suddenly...it starts 2 rotate in opp direction sddenly. !! i was readin one page where this code was there and so i gave it a shot.still studyin it :)   ;  HiI got some very good help with how to do this.If you dig into the code here you will see one way to do it, using a vector class   ;  The up vector doesn't matter as long as its dot product with the ACTUAL up direction is positive.  In other words, as long the actual up direction is somewhere INSIDE of the +z half-space, the vector <0, 1, 0> will suffice.JohnBolton did a good job of describing when you need to be concerned about it and how to calculate the real one if you ever need it.