[Bf-blender-cvs] [9e2fa35] soc-2014-viewport_context: fixes to some misplaced ifdefs in GHOST_ContextGLX

Jason Wilkins noreply at git.blender.org
Mon Jul 28 22:38:22 CEST 2014


Commit: 9e2fa35dea821862c3538b5509450bd8e3a5c866
Author: Jason Wilkins
Date:   Mon Jul 28 15:34:23 2014 -0500
Branches: soc-2014-viewport_context
https://developer.blender.org/rB9e2fa35dea821862c3538b5509450bd8e3a5c866

fixes to some misplaced ifdefs in GHOST_ContextGLX

===================================================================

M	intern/ghost/intern/GHOST_ContextGLX.cpp
M	intern/ghost/intern/GHOST_ContextGLX.h

===================================================================

diff --git a/intern/ghost/intern/GHOST_ContextGLX.cpp b/intern/ghost/intern/GHOST_ContextGLX.cpp
index 2d4294b..27846fb 100644
--- a/intern/ghost/intern/GHOST_ContextGLX.cpp
+++ b/intern/ghost/intern/GHOST_ContextGLX.cpp
@@ -82,9 +82,8 @@ GHOST_ContextGLX::GHOST_ContextGLX(
 GHOST_ContextGLX::~GHOST_ContextGLX()
 {
 	if (m_display != NULL) {
-#ifdef WITH_GLEW_MX
 		activateGLXEW();
-#endif
+
 		if (m_context != None) {
 			if (m_window != 0 && m_context == ::glXGetCurrentContext())
 				::glXMakeCurrent(m_display, m_window, NULL);
@@ -121,9 +120,7 @@ GHOST_TSuccess GHOST_ContextGLX::swapBuffers()
 GHOST_TSuccess GHOST_ContextGLX::activateDrawingContext()
 {
 	if (m_display) {
-#ifdef WITH_GLEW_MX
 		activateGLXEW();
-#endif
 		activateGLEW();
 
 		return ::glXMakeCurrent(m_display, m_window, m_context) ? GHOST_kSuccess : GHOST_kFailure;
@@ -133,18 +130,18 @@ GHOST_TSuccess GHOST_ContextGLX::activateDrawingContext()
 	}
 }
 
-#ifdef WITH_GLEW_MX
 void GHOST_ContextGLX::initContextGLXEW()
 {
+#ifdef WITH_GLEW_MX
 	glxewContext = new GLXEWContext;
 	memset(glxewContext, 0, sizeof(GLXEWContext));
 
 	delete m_glxewContext;
 	m_glxewContext = glxewContext;
+#endif
 
 	GLEW_CHK(glxewInit());
 }
-#endif
 
 GHOST_TSuccess GHOST_ContextGLX::initializeDrawingContext()
 {
@@ -285,11 +282,9 @@ GHOST_TSuccess GHOST_ContextGLX::initializeDrawingContext()
 
 		initContextGLEW();
 
-#ifdef WITH_GLEW_MX
 		// Seems that this has to be called after MakeCurrent,
 		// which means we cannot use glX extensions until after we create a context
 		initContextGLXEW();
-#endif
 
 		initClearGL();
 		::glXSwapBuffers(m_display, m_window);
diff --git a/intern/ghost/intern/GHOST_ContextGLX.h b/intern/ghost/intern/GHOST_ContextGLX.h
index de730d2..d32adf3 100644
--- a/intern/ghost/intern/GHOST_ContextGLX.h
+++ b/intern/ghost/intern/GHOST_ContextGLX.h
@@ -34,12 +34,17 @@
 
 #include "GHOST_Context.h"
 
+#ifdef WITH_GLEW_MX
+#  define glxewGetContext() glxewContext
+#endif
+
 #include <GL/glxew.h>
+
 #ifdef WITH_GLEW_MX
-#define glxewGetContext() glxewContext
 extern "C" GLXEWContext *glxewContext;
 #endif
 
+
 #ifndef GHOST_OPENGL_GLX_CONTEXT_FLAGS
 #define GHOST_OPENGL_GLX_CONTEXT_FLAGS 0
 #endif
@@ -111,11 +116,11 @@ public:
 	virtual GHOST_TSuccess getSwapInterval(int &intervalOut);
 
 protected:
-#ifdef WITH_GLEW_MX
 	inline void activateGLXEW() const {
+#ifdef WITH_GLEW_MX
 		glxewContext = m_glxewContext;
-	}
 #endif
+	}
 
 private:
 	void initContextGLXEW();




More information about the Bf-blender-cvs mailing list