Try to understand where people come from next time and what exactly are they asking before jumping into so harsh responses, totally uncalled for.
I know exactly where you are coming from. You have code that uses glLookAt and therefore want to use gluLookAt to do what you want. The sad fact is gluLookAt will not do what you want. gluLookAt can be used for many things but it is not ideal to use for a camera other than a look at camera or a flyby type camera.
In fact let's just pretend that you haven't read any tutorials on the internet and that gluLookAt doesn't even exist. So answer my question about yawing the camera left regardless of the world, what is in it, etc. How are you going to yaw the camera to the left. gluLookAt doesn't exist and if it did it still would not help b/c a camera can orient itself regardless of what is in the world. A camera is 3 orientation vectors which in turn produces a view matrix. This view matrix is used to render the scene. World * View * Projection where View is the view matrix for the current camera. Note that if this View is the identity matrix then the camera is at 0,0,0 with yaw of 0.0f, pitch of 0.0f, and roll of 0.0f looking down or up the z zxis depending on the 'handedness' of your coordinate system. The camera is not looking at 0,0,0 and it is not looking at any particular point in space - it is simply oriented in the manner I described.
What you need is a system that can rotate around an arbitrary axis and maintain 3 orthogonal unit vectors that always describe the orientation of the camera. Here are the rotations using axis angle rotations. Note that I've left the function definitions out b/c I'm a Direct3D fella and so my matrices are left-handed instead of right-handed and because you should be able to figure out what they do based on the function names.
Here is some sample incomplete code for a very simple axis-angle based camera.
Code:
void Camera::Yaw(float units)
{
Matrix4x4 m;
if (m_cameraType == CAMERA_LAND)
{
//Account for FPS cameras here so that a yaw will not roll the camera
...
...
}
else
{
m = MatrixRotationAxis(&m_up,units);
}
// Transform vector by matrix, project result back into w = 1.0f
TransformVectorCoord(&m_right,&m);
TransformVectorCoord(&m_look,&m);
}
void Camera::Pitch(float units)
{
Matrix4x4 m;
m = MatrixRotationAxis(&m_right,units);
// Transform vector by matrix, project result back into w = 1.0f
TransformVectorCoord(&m_up,&m);
TransformVectorCoord(&m_look,&m);
}
void Camera::Roll(float units)
{
Matrix4x4 m;
m = MatrixRotationAxis(&m_look,units);
// Transform vector by matrix, project result back into w = 1.0f
TransformVectorCoord(&m_right,&m);
TransformVectorCoord(&m_up,&m);
}
const Matrix4x4 & Camera::GetViewMatrix() const
{
return m_viewMatrix;
}
void Camera::CalculateViewMatrix()
{
MakeOrthogonal();
if (m_viewMode = VIEW_TARGET)
{
// Use gluLookAt to compute view matrix
// Use world up vector as up, camera pos as at, and target pos as eye
}
else
{
// Set m_orbitRadius to 0.0f for FPS camera, else set to non-zero for third person camera
Vector3 pos = m_vecPos + m_look * m_orbitRadius;
...
m_viewMatrix[0] = ............
...
...
}
}
void Camera::Walk(float units)
{
m_vecPos += m_look * units;
}
void Camera::Strafe(float units)
{
m_vecPos += m_right * units;
}
void Camera::Fly(float units)
{
m_vecPos += m_up * units;
}
void Camera::MakeOrthogonal()
{
m_look = Normalize(&m_look);
m_up = Cross(&m_look,&m_right);
m_right = Cross(&m_up,&m_look);
m_up = Normalize(&m_up);
m_right = Normalize(&m_right);
}
...
...
That should be enough to get you started. I also have a quaternion camera and orientation class but it is heavier on the math. The code is actually simpler but the math is far more complex. Several people on this forum or other forums can help you with a quaternion camera.
Once you get this done you will have a camera that can orient itself regardless of the world around it and move it freely through that world without having to focus on one specific 3D point or object - that is unless your camera is in target or flyby mode in which case it must have a target point or object.
An RTS camera is similar to this except that when you move you do not want to move on Y and you may need 3 more vectors to represent the orientation of the motion of the camera.
Also be extremely careful when looking at tutorials. They often gloss over important details that may not be important to the tutorial but are extremely important to you if you want to integrate their code into a larger system. The devil is always in the details and those details can leave you wandering out in the weeds for days or weeks. Also tutorials are normally geared towards showing one effect or technique and do not give you the bigger picture. They may load textures, meshes, sounds, etc. will nilly with no thought for memory management and this just cannot be done in a larger system without some serious consequences. They also tend to hide gotchas caused by their approach to the problem which is usually the brute force approach which is almost always incorrect.
Tutorials are good but they won't get you all that far. You will need read books and white papers from Siggraph as well as articles from GDC, Gamasutra, and/or Gamedev to really begin to understand what is going on under the hood. Once you figure that out you will need to read books about game and engine design in order to get all that 'stuff' working in a larger system. I think you will find it is impossible to code even a small graphical game without some type of framework holding it all together.