From da7ae5394142504d6fe86ce792e37f4826e048a8 Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Tue, 20 Dec 2016 17:34:12 -0800 Subject: [PATCH] render regular view on desktop in VR, instead of distortion view. --- examples/StandaloneMain/hellovr_opengl_main.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/examples/StandaloneMain/hellovr_opengl_main.cpp b/examples/StandaloneMain/hellovr_opengl_main.cpp index 1a840b834..1924869b6 100644 --- a/examples/StandaloneMain/hellovr_opengl_main.cpp +++ b/examples/StandaloneMain/hellovr_opengl_main.cpp @@ -21,6 +21,7 @@ #include "LinearMath/btIDebugDraw.h" int gSharedMemoryKey = -1; int gDebugDrawFlags = 0; +bool gDisplayDistortion = false; //how can you try typing on a keyboard, without seeing it? //it is pretty funny, to see the desktop in VR! @@ -831,15 +832,31 @@ void CMainApplication::RenderFrame() DrawControllers(); } RenderStereoTargets(); + + if (gDisplayDistortion) { B3_PROFILE("RenderDistortion"); RenderDistortion(); + } else + { + glBindFramebuffer( GL_FRAMEBUFFER, 0 ); + glDisable( GL_MULTISAMPLE ); + glBindFramebuffer(GL_READ_FRAMEBUFFER, rightEyeDesc.m_nRenderFramebufferId ); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); + + glBlitFramebuffer( 0, 0, m_nRenderWidth, m_nRenderHeight, 0, 0, m_nRenderWidth, m_nRenderHeight, + GL_COLOR_BUFFER_BIT, + GL_LINEAR ); + + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0 ); } vr::Texture_t leftEyeTexture = {(void*)leftEyeDesc.m_nResolveTextureId, vr::API_OpenGL, vr::ColorSpace_Gamma }; vr::VRCompositor()->Submit(vr::Eye_Left, &leftEyeTexture ); vr::Texture_t rightEyeTexture = {(void*)rightEyeDesc.m_nResolveTextureId, vr::API_OpenGL, vr::ColorSpace_Gamma }; vr::VRCompositor()->Submit(vr::Eye_Right, &rightEyeTexture ); + } if ( m_bVblank && m_bGlFinishHack )