From a38093ad61f7f4418b30d85433a5d0eb97b717f2 Mon Sep 17 00:00:00 2001 From: erwincoumans Date: Wed, 13 Feb 2019 14:43:39 -0800 Subject: [PATCH] deal properly with resize/retina in eglPlugin/eglRendererVisualShapeConverter --- examples/SharedMemory/physx/PhysXServerCommandProcessor.cpp | 3 +++ .../plugins/eglPlugin/eglRendererVisualShapeConverter.cpp | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/SharedMemory/physx/PhysXServerCommandProcessor.cpp b/examples/SharedMemory/physx/PhysXServerCommandProcessor.cpp index 1d18b3143..c3a287f0d 100644 --- a/examples/SharedMemory/physx/PhysXServerCommandProcessor.cpp +++ b/examples/SharedMemory/physx/PhysXServerCommandProcessor.cpp @@ -1839,9 +1839,12 @@ bool PhysXServerCommandProcessor::processForwardDynamicsCommand(const struct Sha float* depthBuffer = 0; int* segmentationMaskBuffer = 0; int startPixelIndex = 0; + int width = 1024; int height = 768; + m_data->m_pluginManager.getRenderInterface()->getWidthAndHeight(width, height); int numPixelsCopied = 0; + m_data->m_pluginManager.getRenderInterface()->copyCameraImageData(pixelRGBA, numRequestedPixels, depthBuffer, numRequestedPixels, diff --git a/examples/SharedMemory/plugins/eglPlugin/eglRendererVisualShapeConverter.cpp b/examples/SharedMemory/plugins/eglPlugin/eglRendererVisualShapeConverter.cpp index 05e24945b..9f4943e4d 100644 --- a/examples/SharedMemory/plugins/eglPlugin/eglRendererVisualShapeConverter.cpp +++ b/examples/SharedMemory/plugins/eglPlugin/eglRendererVisualShapeConverter.cpp @@ -241,7 +241,9 @@ static void SimpleResizeCallback(float widthf, float heightf) if (gWindow && gWindow->m_data->m_instancingRenderer) { gWindow->m_data->m_instancingRenderer->resize(width, height); + gWindow->setWidthAndHeight(width, height); } + //if (gApp && gApp->m_instancingRenderer) // gApp->m_instancingRenderer->resize(width, height); @@ -1281,7 +1283,7 @@ void EGLRendererVisualShapeConverter::copyCameraImageDataGL( { m_data->m_window->endRendering(); m_data->m_window->startRendering(); - glViewport(0,0, sourceWidth, sourceHeight); + glViewport(0,0, sourceWidth*m_data->m_window->getRetinaScale(), sourceHeight*m_data->m_window->getRetinaScale()); B3_PROFILE("m_instancingRenderer render"); m_data->m_instancingRenderer->writeTransforms(); if (m_data->m_hasLightDirection) @@ -1373,7 +1375,7 @@ void EGLRendererVisualShapeConverter::copyCameraImageDataGL( { { m_data->m_window->startRendering(); - glViewport(0,0, sourceWidth, sourceHeight); + glViewport(0,0, sourceWidth*m_data->m_window->getRetinaScale(), sourceHeight*m_data->m_window->getRetinaScale()); BT_PROFILE("renderScene"); m_data->m_instancingRenderer->renderSceneInternal(B3_SEGMENTATION_MASK_RENDERMODE); }