Skip to content

Commit 5f48109

Browse files
Switch to GL3+ RenderSystem and enable RTShaderSystem
1 parent d7cfaba commit 5f48109

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ if(NOT DEFINED ASSIMP_LIBRARIES AND TARGET assimp::assimp)
2828
set(ASSIMP_LIBRARIES assimp::assimp)
2929
endif()
3030

31-
find_package(OGRE QUIET COMPONENTS Overlay)
31+
find_package(OGRE QUIET COMPONENTS Overlay RTShaderSystem)
3232
if(OGRE_FOUND)
3333
if(${OGRE_VERSION} VERSION_LESS 1.11)
3434
set(OGRE_INCLUDE_DIRS ${OGRE_INCLUDE_DIRS} ${OGRE_Overlay_INCLUDE_DIRS})
@@ -38,7 +38,7 @@ else()
3838
# OGRE doesn't come with correctly installed cmake files on Linux. Use pkg-config instead.
3939
# We need both, OGRE and OGRE-Overlay. Look for both simulatenously and use prefix X_
4040
find_package(PkgConfig REQUIRED)
41-
pkg_check_modules(X REQUIRED OGRE OGRE-Overlay)
41+
pkg_check_modules(X REQUIRED OGRE OGRE-Overlay OGRE-RTShaderSystem)
4242

4343
# Set OGRE_* variables as cmake-based find_package would do
4444
set(OGRE_VERSION ${X_OGRE_VERSION})

default.rviz

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Visualization Manager:
3333
Cell Size: 1
3434
Class: rviz/Grid
3535
Color: 160; 160; 164
36-
Enabled: true
36+
Enabled: false
3737
Line Style:
3838
Line Width: 0.03
3939
Value: Lines

src/rviz/ogre_helpers/render_system.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ void RenderSystem::loadOgrePlugins()
163163
#ifdef Q_OS_MAC
164164
plugin_prefix += "lib";
165165
#endif
166-
ogre_root_->loadPlugin(plugin_prefix + "RenderSystem_GL");
166+
ogre_root_->loadPlugin(plugin_prefix + "RenderSystem_GL3Plus");
167167
ogre_root_->loadPlugin(plugin_prefix + "Plugin_OctreeSceneManager");
168168
ogre_root_->loadPlugin(plugin_prefix + "Plugin_ParticleFX");
169169
#if OGRE_VERSION >= OGRE_VERSION_CHECK(1, 11, 0)

src/rviz/visualization_manager.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include <OgreMaterialManager.h>
4646
#include <OgreMaterial.h>
4747
#include <OgreRenderWindow.h>
48+
#include <OgreRTShaderSystem.h>
4849
#include <OgreSharedPtr.h>
4950
#include <OgreCamera.h>
5051

@@ -146,6 +147,12 @@ VisualizationManager::VisualizationManager(RenderPanel* render_panel,
146147

147148
rviz::RenderSystem::RenderSystem::get()->prepareOverlays(scene_manager_);
148149

150+
using namespace Ogre;
151+
// register our scene with the RTSS
152+
RTShader::ShaderGenerator::initialize();
153+
RTShader::ShaderGenerator* shadergen = RTShader::ShaderGenerator::getSingletonPtr();
154+
shadergen->addSceneManager(scene_manager_);
155+
149156
directional_light_ = scene_manager_->createLight("MainDirectional");
150157
directional_light_->setType(Ogre::Light::LT_DIRECTIONAL);
151158
directional_light_->setDirection(Ogre::Vector3(-1, 0, -1));

0 commit comments

Comments
 (0)