From 91c81a6319156df3df765fd4668a2d51c2761d16 Mon Sep 17 00:00:00 2001 From: jules Date: Sun, 26 Oct 2014 10:25:56 +0000 Subject: [PATCH] Avoided a crash in openGL when running on very old Windows drivers. --- modules/juce_opengl/opengl/juce_OpenGLContext.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp index ee98359712..af9710bd96 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp @@ -262,7 +262,16 @@ public: glEnable (GL_TEXTURE_2D); clearGLError(); #endif - context.extensions.glActiveTexture (GL_TEXTURE0); + + #if JUCE_WINDOWS + // some stupidly old drivers are missing this function, so try to at least avoid a crash here, + // but if you hit this assertion you may want to have your own version check before using the + // component rendering stuff on such old drivers. + jassert (glActiveTexture.context.extensions != nullptr); + if (glActiveTexture.context.extensions != nullptr) + #endif + context.extensions.glActiveTexture (GL_TEXTURE0); + glBindTexture (GL_TEXTURE_2D, cachedImageFrameBuffer.getTextureID()); const Rectangle cacheBounds (cachedImageFrameBuffer.getWidth(), cachedImageFrameBuffer.getHeight());