Use glFrustum rather than Oculus's projection utility method, which seems to

be returning weird results.
This commit is contained in:
Andrzej Kapolka 2014-11-03 21:13:01 -08:00
parent e76a8c2234
commit 3ba3299e35

View file

@ -420,7 +420,7 @@ void OculusManager::endFrameTiming() {
//Sets the camera FoV and aspect ratio
void OculusManager::configureCamera(Camera& camera, int screenWidth, int screenHeight) {
#ifdef HAVE_LIBOVR
camera.setAspectRatio(_renderTargetSize.w / _renderTargetSize.h);
camera.setAspectRatio((float)_renderTargetSize.w / _renderTargetSize.h);
camera.setFieldOfView(atan(_eyeFov[0].UpTan) * DEGREES_PER_RADIAN * 2.0f);
#endif
}
@ -511,12 +511,12 @@ void OculusManager::display(const glm::quat &bodyOrientation, const glm::vec3 &p
_camera->update(1.0f / Application::getInstance()->getFps());
Matrix4f proj = ovrMatrix4f_Projection(_eyeRenderDesc[eye].Fov, whichCamera.getNearClip(), whichCamera.getFarClip(), true);
proj.Transpose();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glLoadMatrixf((GLfloat *)proj.M);
const ovrFovPort& port = _eyeFov[_activeEyeIndex];
float near = whichCamera.getNearClip(), far = whichCamera.getFarClip();
glFrustum(-near * port.LeftTan, near * port.RightTan, -near * port.DownTan, near * port.UpTan, near, far);
glViewport(_eyeRenderViewport[eye].Pos.x, _eyeRenderViewport[eye].Pos.y,
_eyeRenderViewport[eye].Size.w, _eyeRenderViewport[eye].Size.h);