diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-05-20 14:16:09 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-05-21 10:04:50 +0100 |
commit | 5d4e68d51eecfbe37e17f59cc7f7f042c69a65e9 (patch) | |
tree | 26676c62be78ba61a91ae9168cc806d7a23e5b9e /vcl/unx | |
parent | 81283a891f274226113f6d136c251c2ba1538b4c (diff) |
move glX stuff to X-only modules
Change-Id: I8ca818dac72f0368b6af10c838603e63c7c85b1e
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/generic/app/saldisp.cxx | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index dd5ce040d610..ec5325066e04 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -47,6 +47,9 @@ #include <X11/extensions/Xinerama.h> #endif +#include "GL/glxew.h" +#include <opengl/zone.hxx> + #include <vcl/svapp.hxx> #include <vcl/settings.hxx> @@ -183,6 +186,30 @@ sal_GetServerVendor( Display *p_display ) return vendor_unknown; } +bool SalDisplay::BestOpenGLVisual(Display* pDisplay, int nScreen, XVisualInfo& rVI) +{ + OpenGLZone aZone; + + XVisualInfo* pVI; + int aAttrib[] = { GLX_RGBA, + GLX_RED_SIZE, 8, + GLX_GREEN_SIZE, 8, + GLX_BLUE_SIZE, 8, + GLX_DEPTH_SIZE, 24, + GLX_STENCIL_SIZE, 8, + None }; + + pVI = glXChooseVisual( pDisplay, nScreen, aAttrib ); + if( !pVI ) + return false; + + rVI = *pVI; + XFree( pVI ); + + CHECK_GL_ERROR(); + return true; +} + bool SalDisplay::BestVisual( Display *pDisplay, int nScreen, XVisualInfo &rVI ) @@ -198,7 +225,7 @@ bool SalDisplay::BestVisual( Display *pDisplay, try { bool bUseOpenGL = OpenGLHelper::isVCLOpenGLEnabled(); - if( bUseOpenGL && OpenGLHelper::GetVisualInfo( pDisplay, nScreen, rVI ) ) + if (bUseOpenGL && BestOpenGLVisual(pDisplay, nScreen, rVI)) return rVI.visualid == nDefVID; } catch (const css::uno::DeploymentException&) |