42 pixel_buffer_(pixel_buffer)
44 pixel_buffer_->lock( Ogre::HardwareBuffer::HBL_NORMAL );
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++) {
79 return getQImage(overlay.getTextureWidth(), overlay.getTextureHeight());
92 std::string material_name =
name_ +
"Material";
93 Ogre::OverlayManager* mOverlayMgr = Ogre::OverlayManager::getSingletonPtr();
94 overlay_ = mOverlayMgr->create(
name_);
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);
103 panel_->setMaterialName(panel_material_->getName());
104 overlay_->add2D(panel_);
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");
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);
181 return ScopedPixelBuffer(
texture_->getBuffer());
184 return ScopedPixelBuffer(Ogre::HardwarePixelBufferSharedPtr());
195 panel_->setDimensions(width, height);