From a3ab6efa23a2e5ddd779cc485eb204fec8cfac29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20D=C3=BCrrenberger?= Date: Fri, 23 May 2014 10:43:51 +0200 Subject: [PATCH] Fix application crash when calling Shader::isAvailable() #608. --- src/SFML/Graphics/RenderTarget.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/SFML/Graphics/RenderTarget.cpp b/src/SFML/Graphics/RenderTarget.cpp index e7ee1471..c21668e6 100644 --- a/src/SFML/Graphics/RenderTarget.cpp +++ b/src/SFML/Graphics/RenderTarget.cpp @@ -340,6 +340,9 @@ void RenderTarget::popGLStates() //////////////////////////////////////////////////////////// void RenderTarget::resetGLStates() { + // Check here to make sure a context change does not happen after activate(true) + bool shaderAvailable = Shader::isAvailable(); + if (activate(true)) { // Make sure that extensions are initialized @@ -362,7 +365,7 @@ void RenderTarget::resetGLStates() applyBlendMode(BlendAlpha); applyTransform(Transform::Identity); applyTexture(NULL); - if (Shader::isAvailable()) + if (shaderAvailable) applyShader(NULL); m_cache.useVertexCache = false;