diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index ed417ca458..b0fd376586 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -151,6 +151,7 @@ #include "ui/AddressBarDialog.h" #include "ui/UpdateDialog.h" +static const float MIRROR_FULLSCREEN_DISTANCE = 0.389f; // ON WIndows PC, NVidia Optimus laptop, we want to enable NVIDIA GPU #if defined(Q_OS_WIN) @@ -932,13 +933,15 @@ void Application::paintGL() { } } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { -#if 0 + // TODO put the mirror modifiers somewhere both the app and the overlay can access it + float _rotateMirror = 0.0f; + float _raiseMirror = 0.0f; + float _scaleMirror = 1.0f; _myCamera.setRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f))); _myCamera.setPosition(_myAvatar->getDefaultEyePosition() + glm::vec3(0, _raiseMirror * _myAvatar->getScale(), 0) + (_myAvatar->getOrientation() * glm::quat(glm::vec3(0.0f, _rotateMirror, 0.0f))) * glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror); -#endif } // Update camera position diff --git a/interface/src/devices/OculusManager.cpp b/interface/src/devices/OculusManager.cpp index 98597c4a05..53bacfacbf 100644 --- a/interface/src/devices/OculusManager.cpp +++ b/interface/src/devices/OculusManager.cpp @@ -610,7 +610,7 @@ void OculusManager::display(QGLWidget * glCanvas, RenderArgs* renderArgs, const glViewport(vp.Pos.x, vp.Pos.y, vp.Size.w, vp.Size.h); renderArgs->_renderSide = RenderArgs::MONO; - qApp->displaySide(renderArgs, *_camera, false); + qApp->displaySide(renderArgs, *_camera); //qApp->getApplicationCompositor().displayOverlayTexture(renderArgs); qApp->getApplicationCompositor().displayOverlayTextureHmd(renderArgs, eye); }); diff --git a/interface/src/ui/ApplicationCompositor.cpp b/interface/src/ui/ApplicationCompositor.cpp index b0c21cf77d..d78d79b1ab 100644 --- a/interface/src/ui/ApplicationCompositor.cpp +++ b/interface/src/ui/ApplicationCompositor.cpp @@ -191,6 +191,11 @@ void ApplicationCompositor::displayOverlayTexture(RenderArgs* renderArgs) { return; } + GLuint texture = qApp->getApplicationOverlay().getOverlayTexture(); + if (!texture) { + return; + } + updateTooltips(); vec2 canvasSize = qApp->getCanvasSize(); @@ -198,10 +203,6 @@ void ApplicationCompositor::displayOverlayTexture(RenderArgs* renderArgs) { //Handle fading and deactivation/activation of UI gpu::Batch batch; - GLuint texture = qApp->getApplicationOverlay().getOverlayTexture(); - if (!texture) { - return; - } renderArgs->_context->syncCache(); auto geometryCache = DependencyManager::get(); @@ -262,28 +263,38 @@ void ApplicationCompositor::displayOverlayTextureHmd(RenderArgs* renderArgs, int return; } + updateTooltips(); + vec2 canvasSize = qApp->getCanvasSize(); _textureAspectRatio = aspect(canvasSize); - updateTooltips(); - renderArgs->_context->syncCache(); auto geometryCache = DependencyManager::get(); gpu::Batch batch; - DependencyManager::get()->useSimpleDrawPipeline(batch); + geometryCache->useSimpleDrawPipeline(batch); batch._glDisable(GL_DEPTH_TEST); batch._glDisable(GL_CULL_FACE); batch._glBindTexture(GL_TEXTURE_2D, texture); batch._glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); batch._glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - batch.setViewTransform(Transform()); batch.setProjectionTransform(qApp->getEyeProjection(eye)); + mat4 eyePose = qApp->getEyePose(eye); glm::mat4 overlayXfm = glm::inverse(eyePose); - batch.setModelTransform(overlayXfm); - drawSphereSection(batch); + +#ifdef DEBUG_OVERLAY + { + batch.setModelTransform(glm::translate(mat4(), vec3(0, 0, -2))); + geometryCache->renderUnitQuad(batch, glm::vec4(1)); + } +#else + { + batch.setModelTransform(overlayXfm); + drawSphereSection(batch); + } +#endif // Doesn't actually render renderPointers(batch); diff --git a/interface/src/ui/ApplicationOverlay.cpp b/interface/src/ui/ApplicationOverlay.cpp index a35cdce58b..46264730c2 100644 --- a/interface/src/ui/ApplicationOverlay.cpp +++ b/interface/src/ui/ApplicationOverlay.cpp @@ -46,7 +46,6 @@ static const int MIRROR_VIEW_LEFT_PADDING = 10; static const int MIRROR_VIEW_WIDTH = 265; static const int MIRROR_VIEW_HEIGHT = 215; static const int STATS_HORIZONTAL_OFFSET = MIRROR_VIEW_WIDTH + MIRROR_VIEW_LEFT_PADDING * 2; -static const float MIRROR_FULLSCREEN_DISTANCE = 0.389f; static const float MIRROR_REARVIEW_DISTANCE = 0.722f; static const float MIRROR_REARVIEW_BODY_DISTANCE = 2.56f; static const float MIRROR_FIELD_OF_VIEW = 30.0f;