Original Post
i am having some trouble with learning how to control the camera in opengl tryed couple of different methods but none of them seemed to work, can anyone tell me why this isnt working?(and hopefully help in how to fix it)
class CCamera{
public:
Matrix m_Position,
m_ViewDirection,
m_View;
float Velocity;
//Velocity
CCamera();
~CCamera(){}
Matrix MatrixVectorLength(Matrix,GLfloat);
void LookAt();
void MoveForward(GLfloat);
void rotatex (float degree); // rotate around the x axis
void rotatey (float degree); // rotate around the y axis
void rotatez (float degree); // rotate around the z axis
void rotatexyz (float degree,float x,float y,float z);// rotate around the x, y, and z axis
};
void CCamera::rotatex(float degree)
{
glPushMatrix();
glLoadMatrixf(m_ViewDirection.m_Matrix);
glRotatef( degree, 1.0f, 0.0f, 0.0f);
glGetFloatv(GL_MODELVIEW_MATRIX,m_Position.m_Matrix);
glPopMatrix();
}
void CCamera::rotatey(float degree)
{
glPushMatrix();
glLoadMatrixf(m_ViewDirection.m_Matrix);
glRotatef( degree, 0.0f, 1.0f, 0.0f);
glGetFloatv(GL_MODELVIEW_MATRIX,m_Position.m_Matrix);
glPopMatrix();
}
void CCamera::rotatez(float degree)
{
glPushMatrix();
glLoadIdentity();
glLoadMatrixf(m_ViewDirection.m_Matrix);
glRotatef( degree, 0.0f, 0.0f, 1.0f);
glGetFloatv(GL_MODELVIEW_MATRIX,m_Position.m_Matrix);
glPopMatrix();
}
void CCamera::rotatexyz(float degree,float x,float y,float z)
{
glPushMatrix();
glLoadIdentity();
glLoadMatrixf(m_ViewDirection.m_Matrix);
glRotatef( degree, x, y, z);
glGetFloatv(GL_MODELVIEW_MATRIX,m_Position.m_Matrix);
glPopMatrix();
}