Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all
Unified · Split
| @@ -1273,6 +1273,9 @@ void Application::paintGL() { · 1272 unmodified lines | ||
| 1273 | 1273 | // Primary rendering pass |
| 1274 | 1274 | auto framebufferCache = DependencyManager::get<FramebufferCache>(); |
| 1275 | 1275 | const QSize size = framebufferCache->getFrameBufferSize(); |
| 1276 | + | |
| 1277 | + auto finalFramebuffer = framebufferCache->getFramebuffer(); | |
| 1278 | + | |
| 1276 | 1279 | { |
| 1277 | 1280 | PROFILE_RANGE(__FUNCTION__ "/mainRender"); |
| 1278 | 1281 | PerformanceTimer perfTimer("mainRender"); |
| @@ -1326,9 +1329,34 @@ void Application::paintGL() { · 47 unmodified lines | ||
| 1326 | 1329 | } |
| 1327 | 1330 | displaySide(&renderArgs, _myCamera); |
| 1328 | 1331 | renderArgs._context->enableStereo(false); |
| 1329 | − gpu::doInBatch(renderArgs._context, [](gpu::Batch& batch) { | |
| 1332 | + /* gpu::doInBatch(renderArgs._context, [](gpu::Batch& batch) { | |
| 1330 | 1333 | batch.setFramebuffer(nullptr); |
| 1331 | 1334 | }); |
| 1335 | + */ | |
| 1336 | + float ratio = ((float)QApplication::desktop()->windowHandle()->devicePixelRatio() * getRenderResolutionScale()); | |
| 1337 | + // Flip the src and destination rect horizontally to do the mirror | |
| 1338 | + auto mirrorRect = glm::ivec4(0, 0, _mirrorViewRect.width() * ratio, _mirrorViewRect.height() * ratio); | |
| 1339 | + auto mirrorRectDest = glm::ivec4(mirrorRect.z, mirrorRect.y, mirrorRect.x, mirrorRect.w); | |
| 1340 | + | |
| 1341 | + auto primaryFbo = framebufferCache->getPrimaryFramebuffer(); | |
| 1342 | + /** | |
| 1343 | + gpu::doInBatch(renderArgs._context, [=](gpu::Batch& batch) { | |
| 1344 | + batch.setFramebuffer(finalFramebuffer); | |
| 1345 | + batch.clearColorFramebuffer(gpu::Framebuffer::BUFFER_COLOR0, glm::vec4(0.0f, 0.0f, 0.0f, 0.0f)); | |
| 1346 | + batch.blit(primaryFbo, mirrorRect, finalFramebuffer, mirrorRectDest); | |
| 1347 | + batch.setFramebuffer(nullptr); | |
| 1348 | + }); | |
| 1349 | + */ | |
| 1350 | + gpu::doInBatch(renderArgs._context, [=](gpu::Batch& batch) { | |
| 1351 | + gpu::Vec4i rect; | |
| 1352 | + rect.z = size.width(); | |
| 1353 | + rect.w = size.height(); | |
| 1354 | + batch.setFramebuffer(finalFramebuffer); | |
| 1355 | + batch.clearColorFramebuffer(gpu::Framebuffer::BUFFER_COLOR0, glm::vec4(0.0f, 0.0f, 0.0f, 0.0f)); | |
| 1356 | + batch.blit(primaryFbo, rect, finalFramebuffer, rect); | |
| 1357 | + // batch.setFramebuffer(nullptr); | |
| 1358 | + }); | |
| 1359 | + | |
| 1332 | 1360 | } |
| 1333 | 1361 | |
| 1334 | 1362 | // Overlay Composition, needs to occur after screen space effects have completed |
| @@ -1336,7 +1364,8 @@ void Application::paintGL() { · 1 unmodified line | ||
| 1336 | 1364 | { |
| 1337 | 1365 | PROFILE_RANGE(__FUNCTION__ "/compositor"); |
| 1338 | 1366 | PerformanceTimer perfTimer("compositor"); |
| 1339 | − auto primaryFbo = framebufferCache->getPrimaryFramebuffer(); | |
| 1367 | + // auto primaryFbo = framebufferCache->getPrimaryFramebuffer(); | |
| 1368 | + auto primaryFbo = finalFramebuffer; | |
| 1340 | 1369 | glBindFramebuffer(GL_DRAW_FRAMEBUFFER, gpu::GLBackend::getFramebufferID(primaryFbo)); |
| 1341 | 1370 | if (displayPlugin->isStereo()) { |
| 1342 | 1371 | QRect currentViewport(QPoint(0, 0), QSize(size.width() / 2, size.height())); |
| @@ -1361,7 +1390,8 @@ void Application::paintGL() { · 18 unmodified lines | ||
| 1361 | 1390 | { |
| 1362 | 1391 | PROFILE_RANGE(__FUNCTION__ "/pluginOutput"); |
| 1363 | 1392 | PerformanceTimer perfTimer("pluginOutput"); |
| 1364 | − auto primaryFramebuffer = framebufferCache->getPrimaryFramebuffer(); | |
| 1393 | + auto scratchFramebuffer = finalFramebuffer; | |
| 1394 | + /* auto primaryFramebuffer = framebufferCache->getPrimaryFramebuffer(); | |
| 1365 | 1395 | auto scratchFramebuffer = framebufferCache->getFramebuffer(); |
| 1366 | 1396 | gpu::doInBatch(renderArgs._context, [=](gpu::Batch& batch) { |
| 1367 | 1397 | gpu::Vec4i rect; |
| @@ -1371,7 +1401,7 @@ void Application::paintGL() { · 3 unmodified lines | ||
| 1371 | 1401 | batch.clearColorFramebuffer(gpu::Framebuffer::BUFFER_COLOR0, glm::vec4(0.0f, 0.0f, 0.0f, 0.0f)); |
| 1372 | 1402 | batch.blit(primaryFramebuffer, rect, scratchFramebuffer, rect); |
| 1373 | 1403 | batch.setFramebuffer(nullptr); |
| 1374 | − }); | |
| 1404 | + });*/ | |
| 1375 | 1405 | auto finalTexturePointer = scratchFramebuffer->getRenderBuffer(0); |
| 1376 | 1406 | GLuint finalTexture = gpu::GLBackend::getTextureID(finalTexturePointer); |
| 1377 | 1407 | Q_ASSERT(0 != finalTexture); |