mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-19 13:11:32 +00:00
Use OS X cursor workaround for GL_VENDOR ATI and add an environment variable for control
This commit is contained in:
parent
481c440698
commit
3b24bb9a5e
1 changed files with 9 additions and 2 deletions
|
@ -3,6 +3,7 @@
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
#include <SDL_mouse.h>
|
#include <SDL_mouse.h>
|
||||||
#include <SDL_endian.h>
|
#include <SDL_endian.h>
|
||||||
|
@ -81,6 +82,8 @@ namespace
|
||||||
|
|
||||||
osg::ref_ptr<osg::Image> decompress (osg::ref_ptr<osg::Image> source, float rotDegrees)
|
osg::ref_ptr<osg::Image> decompress (osg::ref_ptr<osg::Image> source, float rotDegrees)
|
||||||
{
|
{
|
||||||
|
// TODO: use software decompression once S3TC patent expires
|
||||||
|
|
||||||
int width = source->s();
|
int width = source->s();
|
||||||
int height = source->t();
|
int height = source->t();
|
||||||
|
|
||||||
|
@ -130,9 +133,13 @@ namespace
|
||||||
osg::ref_ptr<osg::Geometry> geom;
|
osg::ref_ptr<osg::Geometry> geom;
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#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);
|
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));
|
geom = osg::createTexturedQuadGeometry(osg::Vec3(-1,1,0), osg::Vec3(2,0,0), osg::Vec3(0,-2,0));
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue