From 049c4f6caaee4d0843307f6ca1a832cc54b3a89d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 28 Feb 2010 11:08:54 +0000 Subject: [PATCH] Support IRIX version of OpenGL multi sampling constants. Although OpenGL multi sampling extensions originated under IRIX, it doesn't seem to use the standard names for the constants used and uses "SGI" suffix for them instead of "ARB". Add support for IRIX versions of GLX_SAMPLE_BUFFERS_ARB and GLX_SAMPLES_ARB and also check if these constants are defined at all to avoid compilation errors if they are not. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63578 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/unix/glx11.cpp | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/src/unix/glx11.cpp b/src/unix/glx11.cpp index c90b1fc3c4..803a8c88ae 100644 --- a/src/unix/glx11.cpp +++ b/src/unix/glx11.cpp @@ -27,6 +27,16 @@ #include "wx/glcanvas.h" +// IRIX headers call this differently +#ifdef __SGI__ + #ifndef GLX_SAMPLE_BUFFERS_ARB + #define GLX_SAMPLE_BUFFERS_ARB GLX_SAMPLE_BUFFERS_SGIS + #endif + #ifndef GLX_SAMPLES_ARB + #define GLX_SAMPLES_ARB GLX_SAMPLES_SGIS + #endif +#endif // __SGI__ + // ============================================================================ // wxGLContext implementation // ============================================================================ @@ -278,30 +288,33 @@ wxGLCanvasX11::ConvertWXAttrsToGL(const int *wxattrs, int *glattrs, size_t n) break; case WX_GL_SAMPLE_BUFFERS: - if ( !IsGLXMultiSampleAvailable() ) +#ifdef GLX_SAMPLE_BUFFERS_ARB + 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; } +#endif // GLX_SAMPLE_BUFFERS_ARB + // if it was specified just to disable it, no problem + if ( !wxattrs[arg++] ) + continue; - glattrs[p++] = GLX_SAMPLE_BUFFERS_ARB; - break; + // otherwise indicate that it's not supported + return false; case WX_GL_SAMPLES: - if ( !IsGLXMultiSampleAvailable() ) +#ifdef GLX_SAMPLES_ARB + if ( IsGLXMultiSampleAvailable() ) { - if ( !wxattrs[arg++] ) - continue; - - return false; + glattrs[p++] = GLX_SAMPLES_ARB; + break; } +#endif // GLX_SAMPLES_ARB - glattrs[p++] = GLX_SAMPLES_ARB; - break; + if ( !wxattrs[arg++] ) + continue; + + return false; default: wxLogDebug(wxT("Unsupported OpenGL attribute %d"), -- 2.45.2