[Bf-blender-cvs] [9f3f5cb] soc-2014-viewport_context: Support for building without glew-mx on X11
Campbell Barton
noreply at git.blender.org
Mon Jul 28 20:32:46 CEST 2014
Commit: 9f3f5cb03e0fe560a6fdc13943f9f219e5e12474
Author: Campbell Barton
Date: Tue Jul 29 04:32:12 2014 +1000
Branches: soc-2014-viewport_context
https://developer.blender.org/rB9f3f5cb03e0fe560a6fdc13943f9f219e5e12474
Support for building without glew-mx on X11
===================================================================
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 12d76ce..2d4294b 100644
--- a/intern/ghost/intern/GHOST_ContextGLX.cpp
+++ b/intern/ghost/intern/GHOST_ContextGLX.cpp
@@ -41,8 +41,9 @@
#include <cstring>
+#ifdef WITH_GLEW_MX
GLXEWContext *glxewContext = NULL;
-
+#endif
GLXContext GHOST_ContextGLX::s_sharedContext = None;
int GHOST_ContextGLX::s_sharedCount = 0;
@@ -67,8 +68,11 @@ GHOST_ContextGLX::GHOST_ContextGLX(
m_contextFlags(contextFlags),
m_contextResetNotificationStrategy(contextResetNotificationStrategy),
m_visualInfo(NULL),
- m_context(None),
+ m_context(None)
+#ifdef WITH_GLEW_MX
+ ,
m_glxewContext(NULL)
+#endif
{
assert(m_window != 0);
assert(m_display != NULL);
@@ -78,8 +82,9 @@ 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);
@@ -96,7 +101,9 @@ GHOST_ContextGLX::~GHOST_ContextGLX()
}
}
+#ifdef WITH_GLEW_MX
delete m_glxewContext;
+#endif
}
XFree(m_visualInfo);
@@ -114,7 +121,9 @@ 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;
@@ -124,7 +133,7 @@ GHOST_TSuccess GHOST_ContextGLX::activateDrawingContext()
}
}
-
+#ifdef WITH_GLEW_MX
void GHOST_ContextGLX::initContextGLXEW()
{
glxewContext = new GLXEWContext;
@@ -135,7 +144,7 @@ void GHOST_ContextGLX::initContextGLXEW()
GLEW_CHK(glxewInit());
}
-
+#endif
GHOST_TSuccess GHOST_ContextGLX::initializeDrawingContext()
{
@@ -276,9 +285,11 @@ 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 b9b311f..de730d2 100644
--- a/intern/ghost/intern/GHOST_ContextGLX.h
+++ b/intern/ghost/intern/GHOST_ContextGLX.h
@@ -34,10 +34,11 @@
#include "GHOST_Context.h"
-#define glxewGetContext() glxewContext
#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
@@ -110,9 +111,11 @@ public:
virtual GHOST_TSuccess getSwapInterval(int &intervalOut);
protected:
+#ifdef WITH_GLEW_MX
inline void activateGLXEW() const {
glxewContext = m_glxewContext;
}
+#endif
private:
void initContextGLXEW();
@@ -130,7 +133,9 @@ private:
GLXContext m_context;
+#ifdef WITH_GLEW_MX
GLXEWContext *m_glxewContext;
+#endif
/** The first created OpenGL context (for sharing display lists) */
static GLXContext s_sharedContext;
More information about the Bf-blender-cvs
mailing list