From 8623d75b468ff1a495a326cf74ca6d61f1ee4ce7 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Sun, 22 Nov 2015 18:14:16 +0100 Subject: Add check for OpenGL version 2.1 on linux. Unfortunately there's no easy way to show a messagebox here, so just print a warning on fstderr and exit. If we don't call exit() here we get crashes on other blender systems (python, opensubdiv) and it can get tricky to track the initialization state here, so just using exit() should do the trick for now. --- intern/ghost/intern/GHOST_ContextGLX.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'intern/ghost') diff --git a/intern/ghost/intern/GHOST_ContextGLX.cpp b/intern/ghost/intern/GHOST_ContextGLX.cpp index 0ee8da15dea..8e46c9513aa 100644 --- a/intern/ghost/intern/GHOST_ContextGLX.cpp +++ b/intern/ghost/intern/GHOST_ContextGLX.cpp @@ -94,7 +94,7 @@ GHOST_ContextGLX::~GHOST_ContextGLX() if (m_context != None) { if (m_window != 0 && m_context == ::glXGetCurrentContext()) - ::glXMakeCurrent(m_display, m_window, NULL); + ::glXMakeCurrent(m_display, None, NULL); if (m_context != s_sharedContext || s_sharedCount == 1) { assert(s_sharedCount > 0); @@ -308,6 +308,8 @@ const bool GLXEW_ARB_create_context_robustness = GHOST_TSuccess success; if (m_context != NULL) { + const unsigned char *version; + if (!s_sharedContext) s_sharedContext = m_context; @@ -325,7 +327,16 @@ const bool GLXEW_ARB_create_context_robustness = /* re initialize to get the extensions properly */ initContextGLXEW(); - success = GHOST_kSuccess; + version = glGetString(GL_VERSION); + + if (version[0] < '2' || ((version[0] == '2') && (version[2] < '1'))) { + fprintf(stderr, "Error! Blender requires OpenGL 2.1 to run.\n"); + fflush(stderr); + /* ugly, but we get crashes unless a whole bunch of systems are patched. */ + exit(0); + } + else + success = GHOST_kSuccess; } else { /* freeing well clean up the context initialized above */ -- cgit v1.2.3