diff options
author | Brad Davis <[email protected]> | 2014-10-24 12:56:30 -0700 |
---|---|---|
committer | Brad Davis <[email protected]> | 2014-10-24 12:56:30 -0700 |
commit | 496894ecced1b0a4ae5ab176902bbd0f43a31ed1 (patch) | |
tree | 8b7d4be1fc8508253d399d98da6143212ceb8f3c /LibOVR/Src/CAPI/GL/CAPI_GL_HSWDisplay.cpp | |
parent | 911239601768bacf9420ab9cfeffed7e861844ac (diff) |
Updating to 0.4.3 SDK0.4.3-official
Diffstat (limited to 'LibOVR/Src/CAPI/GL/CAPI_GL_HSWDisplay.cpp')
-rw-r--r-- | LibOVR/Src/CAPI/GL/CAPI_GL_HSWDisplay.cpp | 410 |
1 files changed, 64 insertions, 346 deletions
diff --git a/LibOVR/Src/CAPI/GL/CAPI_GL_HSWDisplay.cpp b/LibOVR/Src/CAPI/GL/CAPI_GL_HSWDisplay.cpp index f024ac5..ea0a299 100644 --- a/LibOVR/Src/CAPI/GL/CAPI_GL_HSWDisplay.cpp +++ b/LibOVR/Src/CAPI/GL/CAPI_GL_HSWDisplay.cpp @@ -5,16 +5,16 @@ Content : Implements Health and Safety Warning system. Created : July 7, 2014 Authors : Paul Pedriana -Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved. +Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. -Licensed under the Oculus VR Rift SDK License Version 3.1 (the "License"); +Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); you may not use the Oculus VR Rift SDK except in compliance with the License, which is provided at the time of installation or download, or which otherwise accompanies this software in either electronic or hard copy form. You may obtain a copy of the License at -http://www.oculusvr.com/licenses/LICENSE-3.1 +http://www.oculusvr.com/licenses/LICENSE-3.2 Unless required by applicable law or agreed to in writing, the Oculus VR SDK distributed under the License is distributed on an "AS IS" BASIS, @@ -232,6 +232,8 @@ Texture* LoadTextureTga(RenderParams& rParams, int samplerMode, const uint8_t* p HSWDisplay::HSWDisplay(ovrRenderAPIType api, ovrHmd hmd, const HMDRenderState& renderState) : OVR::CAPI::HSWDisplay(api, hmd, renderState) , RenderParams() + , GLVersionInfo() + , GLContext() , FrameBuffer(0) , pTexture() , pShaderSet() @@ -307,43 +309,58 @@ void HSWDisplay::DisplayInternal() void HSWDisplay::DismissInternal() { HSWDISPLAY_LOG(("[HSWDisplay GL] DismissInternal()")); - UnloadGraphics(); + UnloadGraphicsRequested = true; // We don't directly call UnloadGraphics here because this may be executed within a different thread. } void HSWDisplay::UnloadGraphics() { - // RenderParams: No need to clear. - if(FrameBuffer != 0) - { - glDeleteFramebuffers(1, &FrameBuffer); - FrameBuffer = 0; - } - pTexture.Clear(); - pShaderSet.Clear(); - pVertexShader.Clear(); - pFragmentShader.Clear(); - pVB.Clear(); - if(VAO) + if(pTexture) // If initialized... { - #ifdef OVR_OS_MAC - if(GLVersionInfo.WholeVersion >= 302) + Context currentGLContext; + currentGLContext.InitFromCurrent(); + GLContext.Bind(); + + // RenderParams: No need to clear. + if(FrameBuffer != 0) + { + glDeleteFramebuffers(1, &FrameBuffer); + FrameBuffer = 0; + } + pTexture.Clear(); + pShaderSet.Clear(); + pVertexShader.Clear(); + pFragmentShader.Clear(); + pVB.Clear(); + if(VAO) + { + #ifdef OVR_OS_MAC + if(GLVersionInfo.WholeVersion >= 302) + glDeleteVertexArrays(1, &VAO); + else + glDeleteVertexArraysAPPLE(1, &VAO); + #else glDeleteVertexArrays(1, &VAO); - else - glDeleteVertexArraysAPPLE(1, &VAO); - #else - glDeleteVertexArrays(1, &VAO); - #endif + #endif + + VAO = 0; + VAOInitialized = false; + } + // OrthoProjection: No need to clear. - VAO = 0; - VAOInitialized = false; + currentGLContext.Bind(); + GLContext.Destroy(); } - // OrthoProjection: No need to clear. } void HSWDisplay::LoadGraphics() { + // We assume here that the current GL context is the one our resources will be associated with. + + if(GLVersionInfo.MajorVersion == 0) + GetGLVersionAndExtensions(GLVersionInfo); + if (FrameBuffer == 0) { glGenFramebuffers(1, &FrameBuffer); @@ -424,172 +441,28 @@ void HSWDisplay::LoadGraphics() void HSWDisplay::RenderInternal(ovrEyeType eye, const ovrTexture* eyeTexture) { if(RenderEnabled && eyeTexture) - { - // glGetError clears any previous error state. We call it here in order to start with - // a clean slate, as we are asserting below that our calls do not generate errors. - glGetError(); - - if(GLVersionInfo.MajorVersion == 0) // If not yet initialized... - GetGLVersionAndExtensions(GLVersionInfo); - + { // We need to render to the eyeTexture with the texture viewport. // Setup rendering to the texture. ovrGLTexture* eyeTextureGL = const_cast<ovrGLTexture*>(reinterpret_cast<const ovrGLTexture*>(eyeTexture)); OVR_ASSERT(eyeTextureGL->Texture.Header.API == ovrRenderAPI_OpenGL); - const GLuint kVertexAttribCount = 3; - const GLuint kSavedVertexAttribCount = 8; - - // Save state - // To do: Converge this with the state setting/restoring functionality present in the distortion renderer. - // Consider usage of the EXT_direct_state_access (http://www.opengl.org/registry/specs/EXT/direct_state_access.txt) extension. - // Note that the glGet functions below will block until command buffer has completed. - // glPushAttrib is deprecated, so we use glGet* to save/restore fixed-function settings. - // https://www.opengl.org/sdk/docs/man/docbook4/xhtml/glGet.xml - // - GLint RenderModeSaved = 0; - if(!GLVersionInfo.IsCoreProfile) // glGetIntegerv can fail if an OpenGL 3.x+ core profile is enabled due to GL_RENDER_MODE being no longer supported. - { - glGetIntegerv(GL_RENDER_MODE, &RenderModeSaved); - OVR_ASSERT(glGetError() == 0); - OVR_ASSERT(RenderModeSaved == GL_RENDER); // Make sure it's not GL_SELECT or GL_FEEDBACK. - } - - GLint FrameBufferBindingSaved; // OpenGL renamed GL_FRAMEBUFFER_BINDING to GL_DRAW_FRAMEBUFFER_BINDING and adds GL_READ_FRAMEBUFFER_BINDING. - glGetIntegerv(GL_FRAMEBUFFER_BINDING, &FrameBufferBindingSaved); - OVR_ASSERT(glGetError() == 0); - - GLint TextureBinding2DSaved; - glGetIntegerv(GL_TEXTURE_BINDING_2D, &TextureBinding2DSaved); - OVR_ASSERT(glGetError() == 0); - - GLint ViewportSaved[4]; - glGetIntegerv(GL_VIEWPORT, ViewportSaved); - OVR_ASSERT(glGetError() == 0); - - GLint PolygonModeSaved[2]; // Will be two (e.g. GL_FILL) values, one for the front mode and one for the mode. - glGetIntegerv(GL_POLYGON_MODE, PolygonModeSaved); - OVR_ASSERT(glGetError() == 0); - - GLdouble DepthRangeSaved[2]; - #if defined(OVR_OS_MAC) || defined(OVR_OS_LINUX) - // Using glDepthRange as a conditional will always evaluate to true on Mac/Linux. - glGetDoublev(GL_DEPTH_RANGE, DepthRangeSaved); - #else - GLfloat DepthRangefSaved[2]; - if(glDepthRange) // If we can use the double version (glDepthRangef may not be available)... - glGetDoublev(GL_DEPTH_RANGE, DepthRangeSaved); - else - glGetFloatv(GL_DEPTH_RANGE, DepthRangefSaved); + // We init a temporary Context, Bind our own context, then Bind the temporary context below before exiting. + // It's more exensive to have a temp context copy made here instead of having it as a saved member variable, + // but we can't have a saved member variable because the app might delete the saved member behind our back + // or associate it with another thread, which would cause our bind of it before exiting to be a bad operation. + Context currentGLContext; // To do: Change this to use the AutoContext class that was recently created. + currentGLContext.InitFromCurrent(); + if(GLContext.GetIncarnation() == 0) // If not yet initialized... + GLContext.CreateShared(currentGLContext); + GLContext.Bind(); + #if defined(OVR_OS_MAC) // To consider: merge the following into the Bind function. + GLContext.SetSurface(currentGLContext); #endif - OVR_ASSERT(glGetError() == 0); - - GLint DepthWriteMaskSaved; - glGetIntegerv(GL_DEPTH_WRITEMASK, &DepthWriteMaskSaved); - OVR_ASSERT(glGetError() == 0); - - GLint DepthTestSaved; - glGetIntegerv(GL_DEPTH_TEST, &DepthTestSaved); - OVR_ASSERT(glGetError() == 0); - - // No need to save/restore depth offset because we are neither testing nor writing depth. - - GLint CullFaceSaved; - glGetIntegerv(GL_CULL_FACE, &CullFaceSaved); - OVR_ASSERT(glGetError() == 0); - - GLint FrontFaceSaved; - glGetIntegerv(GL_FRONT_FACE, &FrontFaceSaved); - OVR_ASSERT(glGetError() == 0); - - GLint BlendSaved; - glGetIntegerv(GL_BLEND, &BlendSaved); - OVR_ASSERT(glGetError() == 0); - - GLint BlendSrcRGBSaved, BlendSrcAlphaSaved, BlendDstRGBSaved, BlendDstAlphaSaved; - glGetIntegerv(GL_BLEND_SRC_RGB, &BlendSrcRGBSaved); - glGetIntegerv(GL_BLEND_SRC_ALPHA, &BlendSrcAlphaSaved); - glGetIntegerv(GL_BLEND_DST_RGB, &BlendDstRGBSaved); - glGetIntegerv(GL_BLEND_DST_ALPHA, &BlendDstAlphaSaved); - - GLint DitherSaved; - glGetIntegerv(GL_DITHER, &DitherSaved); - OVR_ASSERT(glGetError() == 0); - - GLint RasterizerDiscardSaved; - glGetIntegerv(GL_RASTERIZER_DISCARD, &RasterizerDiscardSaved); - OVR_ASSERT(glGetError() == 0); - - GLint ScissorTestSaved; - glGetIntegerv(GL_SCISSOR_TEST, &ScissorTestSaved); - OVR_ASSERT(glGetError() == 0); - - GLint SampleMaskSaved = 0; - if (GLVersionInfo.WholeVersion >= 302) // OpenGL 3.2 or later - { - glGetIntegerv(GL_SAMPLE_MASK, &SampleMaskSaved); - OVR_ASSERT(glGetError() == 0); - } - - GLint ColorWriteMaskSaved[4]; - glGetIntegerv(GL_COLOR_WRITEMASK, ColorWriteMaskSaved); - - GLint ArrayBufferBindingSaved; - glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &ArrayBufferBindingSaved); - OVR_ASSERT(glGetError() == 0); - - GLint ProgramSaved; - glGetIntegerv(GL_CURRENT_PROGRAM, &ProgramSaved); - OVR_ASSERT(glGetError() == 0); - - GLint ActiveTextureSaved; - glGetIntegerv(GL_ACTIVE_TEXTURE, &ActiveTextureSaved); - OVR_ASSERT(glGetError() == 0); - - GLint TextureBindingSaved; - glGetIntegerv(GL_TEXTURE_BINDING_2D, &TextureBindingSaved); - OVR_ASSERT(glGetError() == 0); - - GLint VertexArrayBindingSaved = 0; - if (GLVersionInfo.SupportsVAO) - glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &VertexArrayBindingSaved); - - // If the core profile is enabled then we can't get the vertex attributes unless there is - // an active VAO. Otherwise there can be an error with some OpenGL implementations (notably Apple's). - // If the core profile is not enabled then pre-OpenGL 3.0 behavior is possible in which the - // application may not be using VAOs and thus there may be active vertex attributes. - GLint VertexAttribEnabledSaved[kSavedVertexAttribCount]; - GLint VertexAttribSizeSaved[kSavedVertexAttribCount]; - GLint VertexAttribTypeSaved[kSavedVertexAttribCount]; - GLint VertexAttribNormalizedSaved[kSavedVertexAttribCount]; - GLint VertexAttribStrideSaved[kSavedVertexAttribCount]; - GLvoid* VertexAttribPointerSaved[kSavedVertexAttribCount]; - - if(VertexArrayBindingSaved || !GLVersionInfo.IsCoreProfile) - { - for(GLuint i = 0; i < kSavedVertexAttribCount; i++) - { - // https://www.opengl.org/sdk/docs/man/docbook4/xhtml/glVertexAttribPointer.xml - glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &VertexAttribEnabledSaved[i]); - - glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_SIZE, &VertexAttribSizeSaved[i]); - glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_TYPE, &VertexAttribTypeSaved[i]); - glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &VertexAttribNormalizedSaved[i]); - glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_STRIDE, &VertexAttribStrideSaved[i]); - glGetVertexAttribPointerv(i, GL_VERTEX_ATTRIB_ARRAY_POINTER, &VertexAttribPointerSaved[i]); - - OVR_ASSERT(glGetError() == 0); - } - } - // - // End of save state - // Load the graphics if not loaded already. if (!pTexture) - { LoadGraphics(); - } // Calculate ortho projection. GetOrthoProjection(RenderState, OrthoProjection); @@ -598,11 +471,8 @@ void HSWDisplay::RenderInternal(ovrEyeType eye, const ovrTexture* eyeTexture) glBindFramebuffer(GL_FRAMEBUFFER, FrameBuffer); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, eyeTextureGL->OGL.TexId, 0); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0); // We aren't using depth, as we currently want this to overwrite everything. - // GLenum DrawBuffers[1] = { GL_COLOR_ATTACHMENT0 }; - // glDrawBuffers(OVR_ARRAY_COUNT(DrawBuffers), DrawBuffers); GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); OVR_ASSERT(status == GL_FRAMEBUFFER_COMPLETE); OVR_UNUSED(status); - OVR_ASSERT(glGetError() == 0); // Set up the viewport const GLint x = (GLint)eyeTextureGL->Texture.Header.RenderViewport.Pos.x; @@ -610,74 +480,38 @@ void HSWDisplay::RenderInternal(ovrEyeType eye, const ovrTexture* eyeTexture) const GLsizei w = (GLsizei)eyeTextureGL->Texture.Header.RenderViewport.Size.w; const GLsizei h = (GLsizei)eyeTextureGL->Texture.Header.RenderViewport.Size.h; glViewport(x, y, w, h); - OVR_ASSERT(glGetError() == 0); - // Set fixed-function render states - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - OVR_ASSERT(glGetError() == 0); - #if defined(OVR_OS_MAC) || defined(OVR_OS_LINUX) // On Mac/Linux we are directly using OpenGL functions instead of function pointers. - glDepthRange(0.0, 1.0); - #else - if(glDepthRange) // If we can use the double version (glDepthRangef isn't available with older OpenGL, glDepthRange isn't available with OpenGL ES)... - glDepthRange(0.0, 1.0); - else - glDepthRangef(0.f, 1.f); - #endif + // Set fixed-function render states. + //glDepthRange(0.0, 1.0); // This is the default glDepthMask(GL_FALSE); - glDisable(GL_DEPTH_TEST); // Disabling depth test should also have the effect of glDepthMask(GL_FALSE). - glDisable(GL_CULL_FACE); + glDisable(GL_DEPTH_TEST); glFrontFace(GL_CW); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glDisable(GL_DITHER); - glDisable(GL_RASTERIZER_DISCARD); - glDisable(GL_SCISSOR_TEST); - if (GLVersionInfo.WholeVersion >= 302) // OpenGL 3.2 or later - { - glDisable(GL_SAMPLE_MASK); - } - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); - OVR_ASSERT(glGetError() == 0); // Enable the buffer and shaders we use. ShaderFill fill(pShaderSet); - if(pTexture) - { + if (pTexture) fill.SetTexture(0, pTexture); - OVR_ASSERT(glGetError() == 0); - } // Set shader uniforms. const float scale = HSWDISPLAY_SCALE * ((RenderState.OurHMDInfo.HmdType == HmdType_DK1) ? 0.70f : 1.f); pShaderSet->SetUniform2f("Scale", scale, scale / 2.f); // X and Y scale. Y is a fixed proportion to X in order to give a certain aspect ratio. pShaderSet->SetUniform2f("PositionOffset", OrthoProjection[eye].GetTranslation().x, 0.0f); - OVR_ASSERT(glGetError() == 0); // Set vertex attributes - // To do: We must add support for vertext array objects (VAOs) here. When using an OpenGL 3.2+ core profile, - // the application is required to use vertex array objects and glVertexAttribPointer will fail otherwise. - if (GLVersionInfo.SupportsVAO) { OVR_ASSERT(VAO != 0); - - #ifdef OVR_OS_MAC - if(GLVersionInfo.WholeVersion >= 302) - glBindVertexArray(VAO); - else - glBindVertexArrayAPPLE(VAO); - #else - glBindVertexArray(VAO); - #endif + glBindVertexArray(VAO); } if(!VAOInitialized) // This executes for the case that VAO isn't supported. { glBindBuffer(GL_ARRAY_BUFFER, pVB->GLBuffer); // This must be called before glVertexAttribPointer is called below. - OVR_ASSERT(glGetError() == 0); const GLuint shaderProgram = pShaderSet->Prog; - GLint attributeLocationArray[kVertexAttribCount]; + GLint attributeLocationArray[3]; attributeLocationArray[0] = glGetAttribLocation(shaderProgram, "Position"); glVertexAttribPointer(attributeLocationArray[0], sizeof(Vector3f)/sizeof(float), GL_FLOAT, false, sizeof(HASWVertex), reinterpret_cast<char*>(offsetof(HASWVertex, Pos))); @@ -687,138 +521,22 @@ void HSWDisplay::RenderInternal(ovrEyeType eye, const ovrTexture* eyeTexture) attributeLocationArray[2] = glGetAttribLocation(shaderProgram, "TexCoord"); glVertexAttribPointer(attributeLocationArray[2], sizeof(float[2])/sizeof(float), GL_FLOAT, false, sizeof(HASWVertex), reinterpret_cast<char*>(offsetof(HASWVertex, U))); - OVR_ASSERT(glGetError() == 0); - for (size_t i = 0; i < kVertexAttribCount; i++) + for (size_t i = 0; i < OVR_ARRAY_COUNT(attributeLocationArray); i++) glEnableVertexAttribArray((GLuint)i); - OVR_ASSERT(glGetError() == 0); - - for (size_t i = kVertexAttribCount; i < kSavedVertexAttribCount; i++) - glDisableVertexAttribArray((GLuint)i); - OVR_ASSERT(glGetError() == 0); } fill.Set(Prim_TriangleStrip); - OVR_ASSERT(glGetError() == 0); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - OVR_ASSERT(glGetError() == 0); if (GLVersionInfo.SupportsVAO) { VAOInitialized = true; - - #ifdef OVR_OS_MAC - if(GLVersionInfo.WholeVersion >= 302) - glBindVertexArray(0); - else - glBindVertexArrayAPPLE(0); - #else - glBindVertexArray(0); - #endif + glBindVertexArray(0); } - - // Restore state - // We restore the state in the reverse order that we saved it. - // To do: Make the code below avoid changes that are effectively no-ops. - // - if (GLVersionInfo.SupportsVAO) - { - #ifdef OVR_OS_MAC - if(GLVersionInfo.WholeVersion >= 302) - glBindVertexArray(VertexArrayBindingSaved); - else - glBindVertexArrayAPPLE(VertexArrayBindingSaved); - #else - glBindVertexArray(VertexArrayBindingSaved); - #endif - } - - if(VertexArrayBindingSaved || !GLVersionInfo.IsCoreProfile) // If the OpenGL version is older or in core profile compatibility mode, or if there's a VAO currently installed... - { - for (GLuint i = 0; i < kSavedVertexAttribCount; i++) - { - glVertexAttribPointer(i, VertexAttribSizeSaved[i], VertexAttribTypeSaved[i], (GLboolean)VertexAttribNormalizedSaved[i], VertexAttribStrideSaved[i], VertexAttribPointerSaved[i]); - - if(VertexAttribEnabledSaved[i]) - glEnableVertexAttribArray(i); - else - glDisableVertexAttribArray(i); - - OVR_ASSERT(glGetError() == 0); - } - } - - glBindTexture(GL_TEXTURE_2D, TextureBindingSaved); - glActiveTexture(ActiveTextureSaved); - glUseProgram(ProgramSaved); - glBindBuffer(GL_ARRAY_BUFFER, ArrayBufferBindingSaved); - glColorMask((GLboolean)ColorWriteMaskSaved[0], (GLboolean)ColorWriteMaskSaved[1], (GLboolean)ColorWriteMaskSaved[2], (GLboolean)ColorWriteMaskSaved[3]); - - if (GLVersionInfo.WholeVersion >= 302) // OpenGL 3.2 or later - { - if(SampleMaskSaved) - glEnable(GL_SAMPLE_MASK); - else - glDisable(GL_SAMPLE_MASK); - } - - if(ScissorTestSaved) - glEnable(GL_SCISSOR_TEST); - else - glDisable(GL_SCISSOR_TEST); - - if(RasterizerDiscardSaved) - glEnable(GL_RASTERIZER_DISCARD); - else - glDisable(GL_RASTERIZER_DISCARD); - - if(DitherSaved) - glEnable(GL_DITHER); - else - glDisable(GL_DITHER); - - // With OpenGL 4.0+, we may need to be aware of glBlendFuncSeparatei. - glBlendFuncSeparate(BlendSrcRGBSaved, BlendDstRGBSaved, BlendSrcAlphaSaved, BlendDstAlphaSaved); - - if(BlendSaved) - glEnable(GL_BLEND); - else - glDisable(GL_BLEND); - - glFrontFace(FrontFaceSaved); - - if(CullFaceSaved) - glEnable(GL_CULL_FACE); - else - glDisable(GL_CULL_FACE); - - if(DepthTestSaved) - glEnable(GL_DEPTH_TEST); - else - glDisable(GL_DEPTH_TEST); - - glDepthMask(DepthWriteMaskSaved ? GL_TRUE : GL_FALSE); - #if defined(OVR_OS_MAC) || defined(OVR_OS_LINUX) // On Mac/Linux we are directly using OpenGL functions instead of function pointers. - glDepthRange(DepthRangeSaved[0], DepthRangeSaved[1]); - #else - if(glDepthRange) // If we can use the double version (glDepthRangef may not be available)... - glDepthRange(DepthRangeSaved[0], DepthRangeSaved[1]); - else - glDepthRangef(DepthRangefSaved[0], DepthRangefSaved[1]); - #endif - // For OpenGL 3.x+ core profile mode, glPolygonMode allows only GL_FRONT_AND_BACK and not separate GL_FRONT and GL_BACK. - glPolygonMode(GL_FRONT_AND_BACK, PolygonModeSaved[0]); - glViewport(ViewportSaved[0], ViewportSaved[1], ViewportSaved[2], ViewportSaved[3]); - glBindTexture(GL_TEXTURE_2D, TextureBinding2DSaved); - glBindFramebuffer(GL_FRAMEBUFFER, FrameBufferBindingSaved); - if(!GLVersionInfo.IsCoreProfile) - glRenderMode(RenderModeSaved); - - OVR_ASSERT(glGetError() == 0); - // - // End of restore state + currentGLContext.Bind(); } } |