mhm? ya, I got it all working now. Both cameras. black, if you still have problems with your camera you might want to have a look at this code.

Code:

// construct our camera
CFlyCamera::CFlyCamera() {
vPosition.set(0.0f, 0.0f, 0.0f);
vView.set(0.0f,0.0f, 1.0f);
vStrafe.set(1.0f, 0.0f, 0.0f);
vUp.set(0.0f, 1.0f, 0.0f);
}
// set basic camera properties
void CFlyCamera::set(CVector3 vCameraPosition, CVector3 vCameraTarget, CVector3 vCameraUp) {
vPosition= vCameraPosition;
vView= vPosition -vCameraTarget;
vStrafe= vCameraUp.cross(vView);
vUp= vCameraUp;
// normalize our vectors
vStrafe.normalize();
vUp.normalize();
vView.normalize();
}
// translate the camera along it's axes
void CFlyCamera::translate(float fU, float fV, float fN) {
vPosition.x += fU *vStrafe.x +fV *vUp.x +fN *vView.x;
vPosition.y += fU *vStrafe.y +fV *vUp.y +fN *vView.y;
vPosition.z += fU *vStrafe.z +fV *vUp.z +fN *vView.z;
}
// rotate the camera around it's z
void CFlyCamera::roll(float fAngle) {
rotateInPlane(vStrafe, vUp, -PI/180 *fAngle);
}
// rotate the camera around it's x
void CFlyCamera::pitch(float fAngle) {
rotateInPlane(vView, vUp, PI/180 *fAngle);
}
// rotate the camera around it's y
void CFlyCamera::yaw(float fAngle) {
rotateInPlane(vStrafe, vView, PI/180 *fAngle);
}
// upload the matrix *fg*
void CFlyCamera::updateMatrix() {
float m[16];
m[0]= vStrafe.x; m[4]= vStrafe.y; m[8] = vStrafe.z; m[12]= -vPosition.dot(vStrafe);
m[1]= vUp.x; m[5]= vUp.y; m[9] = vUp.z; m[13]= -vPosition.dot(vUp);
m[2]= vView.x; m[6]= vView.y; m[10]= vView.z; m[14]= -vPosition.dot(vView);
m[3]= 0; m[7]= 0; m[11]= 0; m[15]= 1.0;
poRenderer->setMatrix(kMatrixModelview, m);
}

rotateInPlane is...

Code:

// rotate 2 vectors in the plane they span
void rotateInPlane(CVector3 &vA, CVector3 &vB, float fAngle) {
float fCos= cos(fAngle);
float fSin= sin(fAngle);
CVector3 vTemp;
// calc temp vector between vA and vB in their plane.
// this will be vA later, but we can't yet overwrite it
// since we still need it for vB
vTemp.x= fCos *vA.x +fSin *vB.x;
vTemp.y= fCos *vA.y +fSin *vB.y;
vTemp.z= fCos *vA.z +fSin *vB.z;
// same for vB but -90 degrees
vB.x= -fSin *vA.x +fCos *vB.x; // cos(f+90)=-sin(f) to reduce cos/sin usage
vB.y= -fSin *vA.y +fCos *vB.y;
vB.z= -fSin *vA.z +fCos *vB.z;
// now update vA
vA= vTemp;
}

That works pretty well. Do you see any lock problems here ?