[osg-users] Insert an image before a text

marco....@elmansrl.eu marco.maisano at elmansrl.eu
Tue Dec 15 23:30:45 PST 2020

Hi Guys,

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

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;

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;
osg::StateSet* stateTex = new osg::StateSet();
stateTex->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON);

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

Can anyone show me the right way to go?


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+unsubscribe at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20201215/2659bae8/attachment.html>

More information about the osg-users mailing list