From 9f47607c95402e4c897ce7b447b5866aed5f7a4c Mon Sep 17 00:00:00 2001 From: James Turner Date: Wed, 12 Apr 2017 11:13:14 +0100 Subject: [PATCH] Revert "Remove the Ati viewport hack." This reverts commit 5bf9b3cd028a369b4cb18c6ace5ff41a6b3f4ac1. --- src/Main/main.cxx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 0dfac209e..b7ee1e67e 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -403,6 +403,18 @@ static void upper_case_property(const char *name) p->addChangeListener(muc); } +// this hack is needed to avoid weird viewport sizing within OSG on Windows. +// still required as of March 2017, sad times. +// see for example https://sourceforge.net/p/flightgear/codetickets/1958/ +static void ATIScreenSizeHack() +{ + osg::ref_ptr hackCam = new osg::Camera; + hackCam->setRenderOrder(osg::Camera::PRE_RENDER); + int prettyMuchAnyInt = 1; + hackCam->setViewport(0, 0, prettyMuchAnyInt, prettyMuchAnyInt); + globals->get_renderer()->addCamera(hackCam, false); +} + // Propose NVIDIA Optimus / AMD Xpress to use high-end GPU #if defined(SG_WINDOWS) extern "C" { @@ -541,6 +553,11 @@ int fgMainInit( int argc, char **argv ) fntInit(); globals->get_renderer()->preinit(); + if (fgGetBool("/sim/ati-viewport-hack", true)) { + SG_LOG(SG_GENERAL, SG_WARN, "Enabling ATI/AMD viewport hack"); + ATIScreenSizeHack(); + } + fgOutputSettings(); //try to disable the screensaver