Skip to content

Instantly share code, notes, and snippets.

@binary1248
Created May 23, 2014 00:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save binary1248/cc2c361ee4f425f6febc to your computer and use it in GitHub Desktop.
Save binary1248/cc2c361ee4f425f6febc to your computer and use it in GitHub Desktop.
Context crash fix
src/SFML/Graphics/RenderTarget.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/SFML/Graphics/RenderTarget.cpp b/src/SFML/Graphics/RenderTarget.cpp
index e7ee147..69edd67 100644
--- a/src/SFML/Graphics/RenderTarget.cpp
+++ b/src/SFML/Graphics/RenderTarget.cpp
@@ -340,6 +340,8 @@ void RenderTarget::popGLStates()
////////////////////////////////////////////////////////////
void RenderTarget::resetGLStates()
{
+ bool shaderAvailable = Shader::isAvailable();
+
if (activate(true))
{
// Make sure that extensions are initialized
@@ -362,7 +364,7 @@ void RenderTarget::resetGLStates()
applyBlendMode(BlendAlpha);
applyTransform(Transform::Identity);
applyTexture(NULL);
- if (Shader::isAvailable())
+ if (shaderAvailable)
applyShader(NULL);
m_cache.useVertexCache = false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment