Commit: 8623d75b468ff1a495a326cf74ca6d61f1ee4ce7
Author: Antony Riakiotakis
Date:   Sun Nov 22 18:14:16 2015 +0100
Branches: master
https://developer.blender.org/rB8623d75b468ff1a495a326cf74ca6d61f1ee4ce7

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.

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

M       intern/ghost/intern/GHOST_ContextGLX.cpp

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

diff --git a/intern/ghost/intern/GHOST_ContextGLX.cpp 
b/intern/ghost/intern/GHOST_ContextGLX.cpp
index 0ee8da1..8e46c95 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 */

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to