From 25c70643e3973e14d2f9af514b9d23f09eba8b8b Mon Sep 17 00:00:00 2001 From: jules Date: Thu, 28 Mar 2013 13:13:10 +0000 Subject: [PATCH] OpenGL linux fix, and removed some deprecated GL calls. --- .../juce_opengl/native/juce_OpenGL_android.h | 2 +- modules/juce_opengl/native/juce_OpenGL_ios.h | 2 +- .../juce_opengl/native/juce_OpenGL_linux.h | 4 ++-- modules/juce_opengl/native/juce_OpenGL_osx.h | 2 +- .../juce_opengl/native/juce_OpenGL_win32.h | 2 +- .../juce_opengl/opengl/juce_OpenGLContext.cpp | 3 ++- .../opengl/juce_OpenGLGraphicsContext.cpp | 20 ------------------- 7 files changed, 8 insertions(+), 27 deletions(-) diff --git a/modules/juce_opengl/native/juce_OpenGL_android.h b/modules/juce_opengl/native/juce_OpenGL_android.h index 4032265c63..4653214d3a 100644 --- a/modules/juce_opengl/native/juce_OpenGL_android.h +++ b/modules/juce_opengl/native/juce_OpenGL_android.h @@ -63,7 +63,7 @@ public: glView.clear(); } - void initialiseOnRenderThread() {} + void initialiseOnRenderThread (OpenGLContext&) {} void shutdownOnRenderThread() {} bool makeActive() const noexcept { return isInsideGLCallback; } diff --git a/modules/juce_opengl/native/juce_OpenGL_ios.h b/modules/juce_opengl/native/juce_OpenGL_ios.h index 3c3dd7e48f..089d947011 100644 --- a/modules/juce_opengl/native/juce_OpenGL_ios.h +++ b/modules/juce_opengl/native/juce_OpenGL_ios.h @@ -97,7 +97,7 @@ public: [view release]; } - void initialiseOnRenderThread() {} + void initialiseOnRenderThread (OpenGLContext&) {} void shutdownOnRenderThread() { diff --git a/modules/juce_opengl/native/juce_OpenGL_linux.h b/modules/juce_opengl/native/juce_OpenGL_linux.h index f558530259..a04ff7ed75 100644 --- a/modules/juce_opengl/native/juce_OpenGL_linux.h +++ b/modules/juce_opengl/native/juce_OpenGL_linux.h @@ -103,11 +103,11 @@ public: XFree (bestVisual); } - void initialiseOnRenderThread() + void initialiseOnRenderThread (OpenGLContext& context) { ScopedXLock xlock; renderContext = glXCreateContext (display, bestVisual, (GLXContext) contextToShareWith, GL_TRUE); - makeActive(); + context.makeActive(); } void shutdownOnRenderThread() diff --git a/modules/juce_opengl/native/juce_OpenGL_osx.h b/modules/juce_opengl/native/juce_OpenGL_osx.h index cc8d0c0878..210d2f55f9 100644 --- a/modules/juce_opengl/native/juce_OpenGL_osx.h +++ b/modules/juce_opengl/native/juce_OpenGL_osx.h @@ -81,7 +81,7 @@ public: renderContext = nil; } - void initialiseOnRenderThread() {} + void initialiseOnRenderThread (OpenGLContext&) {} void shutdownOnRenderThread() { deactivateCurrentContext(); } bool createdOk() const noexcept { return getRawContext() != nullptr; } diff --git a/modules/juce_opengl/native/juce_OpenGL_win32.h b/modules/juce_opengl/native/juce_OpenGL_win32.h index 2d23690830..d3e2e4710b 100644 --- a/modules/juce_opengl/native/juce_OpenGL_win32.h +++ b/modules/juce_opengl/native/juce_OpenGL_win32.h @@ -81,7 +81,7 @@ public: releaseDC(); } - void initialiseOnRenderThread() {} + void initialiseOnRenderThread (OpenGLContext&) {} void shutdownOnRenderThread() { deactivateCurrentContext(); } static void deactivateCurrentContext() { wglMakeCurrent (0, 0); } diff --git a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp index e9e5092b96..d8ea239cc3 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp @@ -324,7 +324,8 @@ public: jassert (! cachedImageFrameBuffer.isValid()); context.makeActive(); - nativeContext->initialiseOnRenderThread(); + nativeContext->initialiseOnRenderThread (context); + glViewport (0, 0, component.getWidth(), component.getHeight()); context.extensions.initialise(); diff --git a/modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp b/modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp index a95d025144..12f259f975 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp @@ -1118,21 +1118,6 @@ public: target.makeActive(); blendMode.resync(); JUCE_CHECK_OPENGL_ERROR - - #ifdef GL_COLOR_ARRAY - glDisableClientState (GL_COLOR_ARRAY); - glDisableClientState (GL_NORMAL_ARRAY); - glDisableClientState (GL_VERTEX_ARRAY); - glDisableClientState (GL_INDEX_ARRAY); - - for (int i = 3; --i >= 0;) - { - activeTextures.setActiveTexture (i); - glDisableClientState (GL_TEXTURE_COORD_ARRAY); - } - #endif - - JUCE_CHECK_OPENGL_ERROR activeTextures.clear(); shaderQuadQueue.initialise(); JUCE_CHECK_OPENGL_ERROR @@ -1142,11 +1127,6 @@ public: { flush(); target.context.extensions.glBindFramebuffer (GL_FRAMEBUFFER, previousFrameBufferTarget); - - #if defined (GL_INDEX_ARRAY) - glDisableClientState (GL_INDEX_ARRAY); - #endif - target.context.extensions.glBindBuffer (GL_ARRAY_BUFFER, 0); target.context.extensions.glBindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0); }