42 pixel_buffer_(pixel_buffer)
59 const Ogre::PixelBox& pixelBox =
pixel_buffer_->getCurrentLock();
60 Ogre::uint8* pDest =
static_cast<Ogre::uint8*
> (pixelBox.data);
61 memset(pDest, 0, width * height);
62 return QImage(pDest, width, height, QImage::Format_ARGB32 );
66 unsigned int width,
unsigned int height, QColor&
bg_color)
69 for (
unsigned int i = 0; i < width; i++) {
70 for (
unsigned int j = 0; j < height; j++) {
71 Hud.setPixel(i, j, bg_color.rgba());
92 std::string material_name =
name_ +
"Material";
93 Ogre::OverlayManager* mOverlayMgr = Ogre::OverlayManager::getSingletonPtr();
95 panel_ =
static_cast<Ogre::PanelOverlayElement*
> (
96 mOverlayMgr->createOverlayElement(
"Panel",
name_ +
"Panel"));
97 panel_->setMetricsMode(Ogre::GMM_PIXELS);
100 = Ogre::MaterialManager::getSingleton().create(
102 Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
111 Ogre::MaterialManager::getSingleton().remove(
panel_material_->getName());
144 const std::string texture_name =
name_ +
"Texture";
146 ROS_WARN(
"[OverlayObject] width=0 is specified as texture size");
150 ROS_WARN(
"[OverlayObject] height=0 is specified as texture size");
155 (height !=
texture_->getHeight()))) {
157 Ogre::TextureManager::getSingleton().remove(texture_name);
159 ->removeAllTextureUnitStates();
161 texture_ = Ogre::TextureManager::getSingleton().createManual(
163 Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
171 ->createTextureUnitState(texture_name);
174 ->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
190 panel_->setPosition(left, top);
195 panel_->setDimensions(width, height);
virtual void setDimensions(double width, double height)
virtual QImage getQImage(unsigned int width, unsigned int height)
OverlayObject(const std::string &name)
Ogre::TexturePtr texture_
Ogre::HardwarePixelBufferSharedPtr pixel_buffer_
virtual ScopedPixelBuffer getBuffer()
virtual ~ScopedPixelBuffer()
Ogre::MaterialPtr panel_material_
virtual unsigned int getTextureWidth()
virtual void updateTextureSize(unsigned int width, unsigned int height)
virtual bool isTextureReady()
virtual void setPosition(double left, double top)
virtual std::string getName()
ScopedPixelBuffer(Ogre::HardwarePixelBufferSharedPtr pixel_buffer)
virtual unsigned int getTextureHeight()
virtual Ogre::HardwarePixelBufferSharedPtr getPixelBuffer()
Ogre::PanelOverlayElement * panel_