linux: make it run over ssh -X forwarding (albeit it laggily) because why not

master
insofaras 2016-07-18 17:03:13 +01:00
parent c9af44f0e7
commit be9dbd1ff8
1 changed files with 11 additions and 8 deletions

View File

@ -1489,13 +1489,16 @@ InitializeOpenGLContext(Display *XDisplay, Window XWindow, GLXFBConfig &bestFbc,
exit(1); exit(1);
} }
b32 Direct;
if (!glXIsDirect(XDisplay, ctx)) if (!glXIsDirect(XDisplay, ctx))
{ {
fprintf(stderr, "Indirect GLX rendering context obtained\n"); fprintf(stderr, "Indirect GLX rendering context obtained\n");
Direct = 0;
} }
else else
{ {
fprintf(stderr, "Direct GLX rendering context obtained\n"); fprintf(stderr, "Direct GLX rendering context obtained\n");
Direct = 1;
} }
fprintf(stderr, "Making context current\n"); fprintf(stderr, "Making context current\n");
@ -1514,7 +1517,7 @@ InitializeOpenGLContext(Display *XDisplay, Window XWindow, GLXFBConfig &bestFbc,
// fprintf(stderr, "GL_EXTENSIONS: %s\n", Extensions); // fprintf(stderr, "GL_EXTENSIONS: %s\n", Extensions);
//NOTE(inso): enable vsync if available. this should probably be optional //NOTE(inso): enable vsync if available. this should probably be optional
if(strstr(glxExts, "GLX_EXT_swap_control ")){ if(Direct && strstr(glxExts, "GLX_EXT_swap_control ")){
GLXLOAD(glXSwapIntervalEXT); GLXLOAD(glXSwapIntervalEXT);
@ -1528,7 +1531,7 @@ InitializeOpenGLContext(Display *XDisplay, Window XWindow, GLXFBConfig &bestFbc,
fprintf(stderr, "VSync enabled? %s.\n", linuxvars.vsync ? "Yes" : "No"); fprintf(stderr, "VSync enabled? %s.\n", linuxvars.vsync ? "Yes" : "No");
} }
} else if(strstr(glxExts, "GLX_MESA_swap_control ")){ } else if(Direct && strstr(glxExts, "GLX_MESA_swap_control ")){
GLXLOAD(glXSwapIntervalMESA); GLXLOAD(glXSwapIntervalMESA);
GLXLOAD(glXGetSwapIntervalMESA); GLXLOAD(glXGetSwapIntervalMESA);
@ -1542,11 +1545,11 @@ InitializeOpenGLContext(Display *XDisplay, Window XWindow, GLXFBConfig &bestFbc,
} else { } else {
// NOTE(inso): assume it worked? // NOTE(inso): assume it worked?
linuxvars.vsync = 1; linuxvars.vsync = 1;
fputs("VSync enabled? possibly (MESA)", stderr); fputs("VSync enabled? possibly (MESA)\n", stderr);
} }
} }
} else if(strstr(glxExts, "GLX_SGI_swap_control ")){ } else if(Direct && strstr(glxExts, "GLX_SGI_swap_control ")){
GLXLOAD(glXSwapIntervalSGI); GLXLOAD(glXSwapIntervalSGI);
@ -1555,11 +1558,11 @@ InitializeOpenGLContext(Display *XDisplay, Window XWindow, GLXFBConfig &bestFbc,
//NOTE(inso): The SGI one doesn't seem to have a way to confirm we got it... //NOTE(inso): The SGI one doesn't seem to have a way to confirm we got it...
linuxvars.vsync = 1; linuxvars.vsync = 1;
fputs("VSync enabled? hopefully (SGI)", stderr); fputs("VSync enabled? hopefully (SGI)\n", stderr);
} }
} else { } else {
fputs("VSync enabled? nope, no suitable extension", stderr); fputs("VSync enabled? nope, no suitable extension\n", stderr);
} }
#if FRED_INTERNAL #if FRED_INTERNAL