diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 64a83d8ae5..2ac7beb28f 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -380,7 +380,62 @@ Renderer::Renderer() if (GL_REPORT_ERROR() != GL_NO_ERROR) bSuccess = false; + + glStencilFunc(GL_ALWAYS, 0, 0); + glBlendFunc(GL_ONE, GL_ONE); + glViewport(0, 0, GetTargetWidth(), GetTargetHeight()); // Reset The Current Viewport + + glClearColor(0.0f, 0.0f, 0.0f, 1.0f); + glClearDepth(1.0f); + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_LEQUAL); + + glPixelStorei(GL_UNPACK_ALIGNMENT, 4); // 4-byte pixel alignment + + glDisable(GL_STENCIL_TEST); + glEnable(GL_SCISSOR_TEST); + + glScissor(0, 0, GetTargetWidth(), GetTargetHeight()); + glBlendColor(0, 0, 0, 0.5f); + glClearDepth(1.0f); + + // this is a hack to work around an ati driver issue. + // usually this shouldn't be needed (and isn't allowed in core) + // but else glGenerateMipmaps wouldn't work always + glEnable(GL_TEXTURE_2D); + + UpdateActiveConfig(); +} + +Renderer::~Renderer() +{ + +#if defined(HAVE_WX) && HAVE_WX + if (scrshotThread.joinable()) + scrshotThread.join(); +#endif + + delete g_framebuffer_manager; +} + +void Renderer::Shutdown() +{ + g_Config.bRunning = false; + UpdateActiveConfig(); + + glDeleteBuffers(1, &s_ShowEFBCopyRegions_VBO); + glDeleteVertexArrays(1, &s_ShowEFBCopyRegions_VAO); + s_ShowEFBCopyRegions_VBO = 0; + + delete s_pfont; + s_pfont = 0; + s_ShowEFBCopyRegions_PS.Destroy(); + s_ShowEFBCopyRegions_VS.Destroy(); +} + +void Renderer::Init() +{ s_pfont = new RasterFont(); PixelShaderCache::CompilePixelShader(s_ShowEFBCopyRegions_PS, @@ -411,57 +466,6 @@ Renderer::Renderer() glVertexAttribPointer(SHADER_POSITION_ATTRIB, 2, GL_FLOAT, 0, sizeof(GLfloat)*5, NULL); glEnableVertexAttribArray(SHADER_COLOR0_ATTRIB); glVertexAttribPointer(SHADER_COLOR0_ATTRIB, 3, GL_FLOAT, 0, sizeof(GLfloat)*5, (GLfloat*)NULL+2); - - glStencilFunc(GL_ALWAYS, 0, 0); - glBlendFunc(GL_ONE, GL_ONE); - - glViewport(0, 0, GetTargetWidth(), GetTargetHeight()); // Reset The Current Viewport - - glClearColor(0.0f, 0.0f, 0.0f, 1.0f); - glClearDepth(1.0f); - glEnable(GL_DEPTH_TEST); - glDepthFunc(GL_LEQUAL); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); // 4-byte pixel alignment - - glDisable(GL_STENCIL_TEST); - glEnable(GL_SCISSOR_TEST); - - glScissor(0, 0, GetTargetWidth(), GetTargetHeight()); - glBlendColor(0, 0, 0, 0.5f); - glClearDepth(1.0f); - - // this is a hack to work around an ati driver issue. - // usually this shouldn't be needed (and isn't allowed in core) - // but else glGenerateMipmaps wouldn't work always - glEnable(GL_TEXTURE_2D); - - UpdateActiveConfig(); - - //return GL_REPORT_ERROR() == GL_NO_ERROR && bSuccess; - return; -} - -Renderer::~Renderer() -{ - g_Config.bRunning = false; - UpdateActiveConfig(); - - glDeleteBuffers(1, &s_ShowEFBCopyRegions_VBO); - glDeleteVertexArrays(1, &s_ShowEFBCopyRegions_VAO); - s_ShowEFBCopyRegions_VBO = 0; - - delete s_pfont; - s_pfont = 0; - s_ShowEFBCopyRegions_PS.Destroy(); - s_ShowEFBCopyRegions_VS.Destroy(); - -#if defined(HAVE_WX) && HAVE_WX - if (scrshotThread.joinable()) - scrshotThread.join(); -#endif - - delete g_framebuffer_manager; } // Create On-Screen-Messages diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.h b/Source/Plugins/Plugin_VideoOGL/Src/Render.h index 9cf1573b56..8ba76d9fcf 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.h @@ -14,6 +14,9 @@ class Renderer : public ::Renderer public: Renderer(); ~Renderer(); + + static void Init(); + static void Shutdown(); void SetColorMask(); void SetBlendMode(bool forceUpdate); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index 4e348fa108..5153f9525d 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -202,6 +202,7 @@ void VideoBackend::Video_Prepare() PixelShaderManager::Init(); ProgramShaderCache::Init(); PostProcessing::Init(); + Renderer::Init(); GL_REPORT_ERRORD(); VertexLoaderManager::Init(); TextureConverter::Init(); @@ -226,6 +227,7 @@ void VideoBackend::Shutdown() // The following calls are NOT Thread Safe // And need to be called from the video thread + Renderer::Shutdown(); TextureConverter::Shutdown(); VertexLoaderManager::Shutdown(); ProgramShaderCache::Shutdown();