diff --git a/src/rviz/ogre_helpers/render_system.cpp b/src/rviz/ogre_helpers/render_system.cpp index 2d13d1b708..ea30deab64 100644 --- a/src/rviz/ogre_helpers/render_system.cpp +++ b/src/rviz/ogre_helpers/render_system.cpp @@ -64,6 +64,7 @@ namespace rviz RenderSystem* RenderSystem::instance_ = 0; int RenderSystem::force_gl_version_ = 0; +bool RenderSystem::use_anti_aliasing_ = true; bool RenderSystem::force_no_stereo_ = false; RenderSystem* RenderSystem::get() @@ -81,6 +82,12 @@ void RenderSystem::forceGlVersion( int version ) ROS_INFO_STREAM( "Forcing OpenGl version " << (float)version / 100.0 << "." ); } +void RenderSystem::disableAntiAliasing() +{ + use_anti_aliasing_ = false; + ROS_INFO("Disabling Anti-Aliasing"); +} + void RenderSystem::forceNoStereo() { force_no_stereo_ = true; @@ -231,7 +238,7 @@ void RenderSystem::setupRenderSystem() // We operate in windowed mode renderSys->setConfigOption("Full Screen","No"); - /// We used to allow the user to set the RTT mode to PBuffer, FBO, or Copy. + /// We used to allow the user to set the RTT mode to PBuffer, FBO, or Copy. /// Copy is slow, and there doesn't seem to be a good reason to use it /// PBuffer limits the size of the renderable area of the RTT to the /// size of the first window created. @@ -239,7 +246,9 @@ void RenderSystem::setupRenderSystem() // renderSys->setConfigOption("RTT Preferred Mode", "FBO"); // Set the Full Screen Anti-Aliasing factor. - renderSys->setConfigOption("FSAA", "4"); + if (use_anti_aliasing_) { + renderSys->setConfigOption("FSAA", "4"); + } ogre_root_->setRenderSystem(renderSys); } @@ -350,7 +359,9 @@ Ogre::RenderWindow* RenderSystem::makeRenderWindow( intptr_t window_id, unsigned params["externalGLControl"] = true; // Enable antialiasing - params["FSAA"] = "4"; + if (use_anti_aliasing_) { + params["FSAA"] = "4"; + } // Set the macAPI for Ogre based on the Qt implementation #ifdef QT_MAC_USE_COCOA diff --git a/src/rviz/ogre_helpers/render_system.h b/src/rviz/ogre_helpers/render_system.h index 5d3883c134..7eb32205c9 100644 --- a/src/rviz/ogre_helpers/render_system.h +++ b/src/rviz/ogre_helpers/render_system.h @@ -60,6 +60,9 @@ class RenderSystem // @brief return GLSL Version as integer, e.g. 150 for GLSL 1.50 int getGlslVersion() { return glsl_version_; } + // @brief Disables the use of Anti Aliasing + static void disableAntiAliasing(); + // @brief Force to use the provided OpenGL version on startup static void forceGlVersion( int version ); @@ -96,6 +99,7 @@ class RenderSystem int gl_version_; int glsl_version_; + static bool use_anti_aliasing_; static int force_gl_version_; bool stereo_supported_; static bool force_no_stereo_; diff --git a/src/rviz/visualizer_app.cpp b/src/rviz/visualizer_app.cpp index cef8ea38cc..d549d442aa 100644 --- a/src/rviz/visualizer_app.cpp +++ b/src/rviz/visualizer_app.cpp @@ -134,6 +134,7 @@ bool VisualizerApp::init( int argc, char** argv ) ("ogre-log,l", "Enable the Ogre.log file (output in cwd) and console output.") ("in-mc-wrapper", "Signal that this is running inside a master-chooser wrapper") ("opengl", po::value(), "Force OpenGL version (use '--opengl 210' for OpenGL 2.1 compatibility mode)") + ("disable-anti-aliasing", "Prevent rviz from trying to use anti-aliasing when rendering.") ("no-stereo", "Disable the use of stereo rendering.") ("verbose,v", "Enable debug visualizations") ("log-level-debug", "Sets the ROS logger level to debug."); @@ -143,6 +144,7 @@ bool VisualizerApp::init( int argc, char** argv ) bool in_mc_wrapper = false; bool verbose = false; int force_gl_version = 0; + bool disable_anti_aliasing = false; bool disable_stereo = false; try { @@ -203,6 +205,11 @@ bool VisualizerApp::init( int argc, char** argv ) force_gl_version = vm["opengl"].as(); } + if (vm.count("disable-anti-aliasing")) + { + disable_anti_aliasing = true; + } + if (vm.count("verbose")) { verbose = true; @@ -243,6 +250,11 @@ bool VisualizerApp::init( int argc, char** argv ) RenderSystem::forceGlVersion( force_gl_version ); } + if (disable_anti_aliasing) + { + RenderSystem::disableAntiAliasing(); + } + if ( disable_stereo ) { RenderSystem::forceNoStereo();