From 3b24bb9a5e370471eb41f2923256cbbabd460411 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 19 Feb 2017 13:38:38 +0100 Subject: [PATCH] Use OS X cursor workaround for GL_VENDOR ATI and add an environment variable for control --- components/sdlutil/sdlcursormanager.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/components/sdlutil/sdlcursormanager.cpp b/components/sdlutil/sdlcursormanager.cpp index ad03083de..411fb3694 100644 --- a/components/sdlutil/sdlcursormanager.cpp +++ b/components/sdlutil/sdlcursormanager.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -81,6 +82,8 @@ namespace osg::ref_ptr decompress (osg::ref_ptr source, float rotDegrees) { + // TODO: use software decompression once S3TC patent expires + int width = source->s(); int height = source->t(); @@ -130,9 +133,13 @@ namespace osg::ref_ptr geom; #if defined(__APPLE__) - // Extra flip needed on Intel graphics OS X systems due to a driver bug + // Extra flip needed on OS X systems due to a driver bug + const char* envval = getenv("OPENMW_CURSOR_WORKAROUND"); + bool workaround = !envval || envval == std::string("1"); std::string vendorString = (const char*)glGetString(GL_VENDOR); - if (vendorString.find("Intel") != std::string::npos) + if (!envval) + workaround = vendorString.find("Intel") != std::string::npos || vendorString.find("ATI") != std::string::npos || vendorString.find("AMD") != std::string::npos; + if (workaround) geom = osg::createTexturedQuadGeometry(osg::Vec3(-1,1,0), osg::Vec3(2,0,0), osg::Vec3(0,-2,0)); else #endif