Hi Guys,

I need to create a label, in which to insert a text and an image from .png 
file.

The label with text ONLY has already been created, as below:

osg::ref_ptr<osgText::Text> text = new osgText::Text;
text->setText("Tryyyy text");
osg::ref_ptr<osg::Geode> textBoat = new osg::Geode;
textBoat->addDrawable(text);

Then, since I have few experience with osg::Image and osg::Text, I tried as 
solution, to implement a texture inside a StateSet to insert into a Geode,

osg::Texture2D* texture = new osg::Texture2D;
texture->setDataVariance(osg::Object::DYNAMIC);
osg::Image* 
Image=osgDB::readImageFile(std::string(url+"/Images/flags_png/abw.png"));
texture->setImage(image);
osg::StateSet* stateTex = new osg::StateSet();
stateTex->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON);
textBoat->setStateSet(stateTex);

Then, the text is correctly created, but I don't have the image.....

Can anyone show me the right way to go?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osg-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osg-users/75b934db-c1f8-423a-8f80-859f508f9a8en%40googlegroups.com.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to