mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 20:44:14 +02:00
Use glFrustum rather than Oculus's projection utility method, which seems to
be returning weird results.
This commit is contained in:
parent
e76a8c2234
commit
3ba3299e35
1 changed files with 5 additions and 5 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue