diff options
Diffstat (limited to 'src/mgl.c')
-rw-r--r-- | src/mgl.c | 67 |
1 files changed, 0 insertions, 67 deletions
@@ -1,7 +1,6 @@ #include "../include/mgl/mgl.h" #include <X11/Xutil.h> #include <X11/XKBlib.h> -#include <X11/extensions/Xrender.h> #include <stdio.h> #ifndef NDEBUG #include <stdlib.h> @@ -23,66 +22,6 @@ static int ignore_xioerror(Display *display) { return 0; } -static int glx_context_init() { - const int attr[] = { - GLX_RENDER_TYPE, GLX_RGBA_BIT, - GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, - GLX_DOUBLEBUFFER, True, - GLX_RED_SIZE, 8, - GLX_GREEN_SIZE, 8, - GLX_BLUE_SIZE, 8, - GLX_ALPHA_SIZE, 8, - GLX_DEPTH_SIZE, 0, - None - }; - - context.fbconfigs = NULL; - context.visual_info = NULL; - context.fbconfig = NULL; - - int numfbconfigs = 0; - context.fbconfigs = context.gl.glXChooseFBConfig(context.connection, DefaultScreen(context.connection), attr, &numfbconfigs); - for(int i = 0; i < numfbconfigs; i++) { - context.visual_info = context.gl.glXGetVisualFromFBConfig(context.connection, context.fbconfigs[i]); - if(!context.visual_info) - continue; - - XRenderPictFormat *pict_format = XRenderFindVisualFormat(context.connection, ((XVisualInfo*)context.visual_info)->visual); - if(!pict_format) { - XFree(context.visual_info); - context.visual_info = NULL; - continue; - } - - context.fbconfig = context.fbconfigs[i]; - if(pict_format->direct.alphaMask > 0) - break; - - XFree(context.visual_info); - context.visual_info = NULL; - context.fbconfig = NULL; - } - - if(!context.visual_info) { - fprintf(stderr, "mgl error: no appropriate visual found\n"); - return -1; - } - - return 0; -} - -static void glx_context_deinit() { - if(context.visual_info) { - XFree(context.visual_info); - context.visual_info = NULL; - } - - if(context.fbconfigs) { - XFree(context.fbconfigs); - context.fbconfigs = NULL; - } -} - int mgl_init(void) { ++init_count; if(init_count == 1) { @@ -111,11 +50,6 @@ int mgl_init(void) { mgl_deinit(); return -1; } - - if(glx_context_init() != 0) { - mgl_deinit(); - return -1; - } } return 0; } @@ -136,7 +70,6 @@ void mgl_deinit(void) { GLX needs to be unloaded after closing the display on nvidia because nvidia registers cleanup callbacks on exit, that uses the x11 display. */ - glx_context_deinit(); mgl_gl_unload(&context.gl); } } |