From 7e815c62d7247d3293c1e571616b638b04a5c47e Mon Sep 17 00:00:00 2001 From: insofaras Date: Fri, 4 Mar 2016 22:22:55 +0000 Subject: [PATCH] add back the glx version checking that was incorrectly removed --- linux_4ed.cpp | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/linux_4ed.cpp b/linux_4ed.cpp index 669a86fa..bf1189f2 100644 --- a/linux_4ed.cpp +++ b/linux_4ed.cpp @@ -1383,6 +1383,28 @@ InitializeOpenGLContext(Display *XDisplay, Window XWindow, GLXFBConfig &bestFbc, return(ctx); } +internal b32 +GLXCanUseFBConfig(Display *XDisplay) +{ + b32 Result = false; + + int GLXMajor, GLXMinor; + + char *XVendor = ServerVendor(XDisplay); + printf("XWindows vendor: %s\n", XVendor); + if(glXQueryVersion(XDisplay, &GLXMajor, &GLXMinor)) + { + printf("GLX version %d.%d\n", GLXMajor, GLXMinor); + if(((GLXMajor == 1 ) && (GLXMinor >= 3)) || + (GLXMajor > 1)) + { + Result = true; + } + } + + return(Result); +} + typedef struct glx_config_result{ b32 Found; GLXFBConfig BestConfig; @@ -1874,7 +1896,12 @@ main(int argc, char **argv) } int XScreenCount = ScreenCount(linuxvars.XDisplay); - glx_config_result Config; + glx_config_result Config = {}; + + if(!GLXCanUseFBConfig(linuxvars.XDisplay)){ + fprintf(stderr, "Your GLX version is too old.\n"); + exit(1); + } for(int XScreenIndex = 0; XScreenIndex < XScreenCount;