public void PositionCamera() { if (m_bResetClippingPlanes) { // Reset our cameras clipping plane ResetView(0, 0); m_bResetClippingPlanes = false; } if (m_fRoll != 0) { msgMatrix matx = new msgMatrix(); msgVectorStruct UpVector; matx.Rotate(zero_p, x_axe, m_fPitch / 180.0 * Math.PI); matx.Rotate(zero_p, y_axe, m_fRoll / 180.0 * Math.PI); matx.Rotate(zero_p, z_axe, -m_fYaw / 180.0 * Math.PI); UpVector = z_axe; matx.ApplyMatrixToVector(zero_p, UpVector); // Position the camera using the newly calculated 'Up' vector OpenGLControl.gluLookAt(m_fEyePos.x, m_fEyePos.y, m_fEyePos.z, m_fLookAtPos.x, m_fLookAtPos.y, m_fLookAtPos.z, UpVector.x, UpVector.y, UpVector.z); } else { // Since our 'Up' vector has already been calculated, all we need to do is // position the camera.. OpenGLControl.gluLookAt(m_fEyePos.x, m_fEyePos.y, m_fEyePos.z, m_fLookAtPos.x, m_fLookAtPos.y, m_fLookAtPos.z, m_fUpVector.x, m_fUpVector.y, m_fUpVector.z); } // Save the Model view matrix. This is used later for // conversion of mouse coordinates to world coordinates. OpenGLControl.glGetDoublev(OpenGLControl.GL_MODELVIEW_MATRIX, m_dModelViewMatrix); }