43 #include <OgreRenderWindow.h>
44 #include <OgreSceneManager.h>
45 #include <OgreViewport.h>
46 #include <OgreRectangle2D.h>
47 #include <OgreMaterial.h>
48 #include <OgreMaterialManager.h>
49 #include <OgreTextureUnitState.h>
50 #include <OgreSharedPtr.h>
51 #include <OgreTechnique.h>
52 #include <OgreSceneNode.h>
61 #if (OGRE_VERSION < OGRE_VERSION_CHECK(13, 0, 0))
76 QtOgreRenderWindow::showEvent(event);
85 if (resolved_image ==
"/image")
87 ROS_WARN(
"image topic has not been remapped");
90 std::stringstream title;
91 title <<
"rviz Image Viewer [" << resolved_image <<
"]";
92 setWindowTitle(QString::fromStdString(title.str()));
107 ROS_ERROR(
"%s", (std::string(
"Error subscribing: ") + e.what()).c_str());
110 Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().create(
111 "Material", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
112 material->setCullingMode(Ogre::CULL_NONE);
113 material->getTechnique(0)->getPass(0)->setDepthWriteEnabled(
true);
114 material->getTechnique(0)->setLightingEnabled(
false);
115 Ogre::TextureUnitState* tu = material->getTechnique(0)->getPass(0)->createTextureUnitState();
117 tu->setTextureFiltering(Ogre::TFO_NONE);
118 tu->setTextureAddressingMode(Ogre::TextureUnitState::TAM_CLAMP);
120 Ogre::Rectangle2D* rect =
new Ogre::Rectangle2D(
true);
121 rect->setCorners(-1.0
f, 1.0
f, 1.0
f, -1.0
f);
123 rect->setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY - 1);
124 Ogre::AxisAlignedBox aabb;
126 rect->setBoundingBox(aabb);
128 Ogre::SceneNode* node =
scene_manager_->getRootSceneNode()->createChildSceneNode();
129 node->attachObject(rect);
130 node->setVisible(
true);
132 QTimer* timer =
new QTimer(
this);
141 static bool first =
true;