diff options
Diffstat (limited to 'intern/ghost/intern/GHOST_ContextEGL.cpp')
-rw-r--r-- | intern/ghost/intern/GHOST_ContextEGL.cpp | 44 |
1 files changed, 13 insertions, 31 deletions
diff --git a/intern/ghost/intern/GHOST_ContextEGL.cpp b/intern/ghost/intern/GHOST_ContextEGL.cpp index 520aa0fffb2..56962d24939 100644 --- a/intern/ghost/intern/GHOST_ContextEGL.cpp +++ b/intern/ghost/intern/GHOST_ContextEGL.cpp @@ -42,11 +42,6 @@ #include <cstring> -#ifdef WITH_GLEW_MX -EGLEWContext *eglewContext = NULL; -#endif - - #define CASE_CODE_RETURN_STR(code) case code: return #code; static const char *get_egl_error_enum_string(EGLenum error) @@ -168,13 +163,8 @@ static bool egl_chk(bool result, const char *file = NULL, int line = 0, const ch static inline bool bindAPI(EGLenum api) { -#ifdef WITH_GLEW_MX - if (eglewContext != NULL) -#endif - { - if (EGLEW_VERSION_1_2) { - return (EGL_CHK(eglBindAPI(api)) == EGL_TRUE); - } + if (EGLEW_VERSION_1_2) { + return (EGL_CHK(eglBindAPI(api)) == EGL_TRUE); } return false; @@ -238,9 +228,6 @@ GHOST_ContextEGL::GHOST_ContextEGL( m_surface(EGL_NO_SURFACE), m_display(EGL_NO_DISPLAY), m_swap_interval(1), -#ifdef WITH_GLEW_MX - m_eglewContext(NULL), -#endif m_sharedContext(choose_api(api, s_gl_sharedContext, s_gles_sharedContext, s_vg_sharedContext)), m_sharedCount (choose_api(api, s_gl_sharedCount, s_gles_sharedCount, s_vg_sharedCount)) { @@ -252,7 +239,6 @@ GHOST_ContextEGL::GHOST_ContextEGL( GHOST_ContextEGL::~GHOST_ContextEGL() { if (m_display != EGL_NO_DISPLAY) { - activateEGLEW(); bindAPI(m_api); @@ -276,10 +262,6 @@ GHOST_ContextEGL::~GHOST_ContextEGL() EGL_CHK(::eglDestroySurface(m_display, m_surface)); EGL_CHK(::eglTerminate(m_display)); - -#ifdef WITH_GLEW_MX - delete m_eglewContext; -#endif } } @@ -321,9 +303,6 @@ GHOST_TSuccess GHOST_ContextEGL::getSwapInterval(int &intervalOut) GHOST_TSuccess GHOST_ContextEGL::activateDrawingContext() { if (m_display) { - activateEGLEW(); - activateGLEW(); - bindAPI(m_api); return EGL_CHK(::eglMakeCurrent(m_display, m_surface, m_surface, m_context)) ? GHOST_kSuccess : GHOST_kFailure; @@ -333,17 +312,20 @@ GHOST_TSuccess GHOST_ContextEGL::activateDrawingContext() } } - -void GHOST_ContextEGL::initContextEGLEW() +GHOST_TSuccess GHOST_ContextEGL::releaseDrawingContext() { -#ifdef WITH_GLEW_MX - eglewContext = new EGLEWContext; - memset(eglewContext, 0, sizeof(EGLEWContext)); + if (m_display) { + bindAPI(m_api); - delete m_eglewContext; - m_eglewContext = eglewContext; -#endif + return EGL_CHK(::eglMakeCurrent(m_display, None, None, NULL)) ? GHOST_kSuccess : GHOST_kFailure; + } + else { + return GHOST_kFailure; + } +} +void GHOST_ContextEGL::initContextEGLEW() +{ if (GLEW_CHK(eglewInit(m_display)) != GLEW_OK) fprintf(stderr, "Warning! EGLEW failed to initialize properly.\n"); } |