X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b73b21173698adb858573d233497657099991b03..ad66316ffbcfd10a4fb448116371d27db3613d17:/src/unix/glx11.cpp diff --git a/src/unix/glx11.cpp b/src/unix/glx11.cpp index ed777163d9..9e1c4464c0 100644 --- a/src/unix/glx11.cpp +++ b/src/unix/glx11.cpp @@ -122,6 +122,26 @@ wxGLCanvasX11::~wxGLCanvasX11() // working with GL attributes // ---------------------------------------------------------------------------- +/* static */ +bool wxGLCanvasBase::IsExtensionSupported(const char *extension) +{ + Display * const dpy = wxGetX11Display(); + + return IsExtensionInList(glXQueryExtensionsString(dpy, DefaultScreen(dpy)), + extension); +} + + +/* static */ +bool wxGLCanvasX11::IsGLXMultiSampleAvailable() +{ + static int s_isMultiSampleAvailable = -1; + if ( s_isMultiSampleAvailable == -1 ) + s_isMultiSampleAvailable = IsExtensionSupported("GLX_ARB_multisample"); + + return s_isMultiSampleAvailable != 0; +} + bool wxGLCanvasX11::ConvertWXAttrsToGL(const int *wxattrs, int *glattrs, size_t n) { @@ -257,6 +277,32 @@ wxGLCanvasX11::ConvertWXAttrsToGL(const int *wxattrs, int *glattrs, size_t n) glattrs[p++] = GLX_ACCUM_ALPHA_SIZE; break; + case WX_GL_SAMPLE_BUFFERS: + if ( !IsGLXMultiSampleAvailable() ) + { + // if it was specified just to disable it, no problem + if ( !wxattrs[arg++] ) + continue; + + // otherwise indicate that it's not supported + return false; + } + + glattrs[p++] = GLX_SAMPLE_BUFFERS_ARB; + break; + + case WX_GL_SAMPLES: + if ( !IsGLXMultiSampleAvailable() ) + { + if ( !wxattrs[arg++] ) + continue; + + return false; + } + + glattrs[p++] = GLX_SAMPLES_ARB; + break; + default: wxLogDebug(_T("Unsupported OpenGL attribute %d"), wxattrs[arg - 1]);