try to fix the scaling issues on mac

This commit is contained in:
samcake 2015-07-23 18:17:10 -07:00
parent ded95a3dde
commit 8421aafe33
2 changed files with 12 additions and 8 deletions

View file

@ -891,10 +891,9 @@ void Application::paintGL() {
renderArgs._renderMode = RenderArgs::NORMAL_RENDER_MODE;
{
auto mirrorViewport = glm::ivec4(0, 0, _mirrorViewRect.width(), _mirrorViewRect.height());
float ratio = 1.0f / ((float)QApplication::desktop()->windowHandle()->devicePixelRatio() * getRenderResolutionScale());
auto mirrorViewportDest = glm::ivec4(0, 0, ratio * mirrorViewport.z, ratio * mirrorViewport.w);
float ratio = ((float)QApplication::desktop()->windowHandle()->devicePixelRatio() * getRenderResolutionScale());
auto mirrorViewport = glm::ivec4(0, 0, _mirrorViewRect.width() * ratio, _mirrorViewRect.height() * ratio);
auto mirrorViewportDest = mirrorViewport;
auto selfieFbo = DependencyManager::get<FramebufferCache>()->getSelfieFramebuffer();
gpu::Batch batch;

View file

@ -183,12 +183,17 @@ void ApplicationOverlay::renderRearView(RenderArgs* renderArgs) {
batch.setProjectionTransform(legacyProjection);
batch.setModelTransform(Transform());
batch.setViewTransform(Transform());
float screenRatio = ((float)qApp->getDevicePixelRatio());
float renderRatio = ((float)screenRatio * qApp->getRenderResolutionScale());
auto viewport = qApp->getMirrorViewRect();
glm::vec2 bottomLeft(viewport.left(), viewport.bottom());
glm::vec2 topRight(viewport.right(), viewport.top());
glm::vec2 bottomLeft(viewport.left(), viewport.top() + viewport.height());
glm::vec2 topRight(viewport.left() + viewport.width(), viewport.top());
bottomLeft *= screenRatio;
topRight *= screenRatio;
glm::vec2 texCoordMinCorner(0.0f, 0.0f);
glm::vec2 texCoordMaxCorner(viewport.width() / float(selfieTexture->getWidth()), viewport.height() / float(selfieTexture->getHeight()));
glm::vec2 texCoordMaxCorner(viewport.width() * renderRatio / float(selfieTexture->getWidth()), viewport.height() * renderRatio / float(selfieTexture->getHeight()));
geometryCache->useSimpleDrawPipeline(batch, false);
batch.setResourceTexture(0, renderArgs->_whiteTexture);