[osg-users] HUD Text Background

67 views
Skip to first unread message

Mike Raider

unread,
Jul 5, 2016, 3:40:20 PM7/5/16
to osg-...@lists.openscenegraph.org
Hi,

What is the best way to place a contrasting color background behind HUD text so that the text is always easy to read?

I did not see anything in osgText to do this....

Also no examples that do this easily.


Thank you, for your suggestions!

Cheers,
Mike

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=68011#68011





_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Jakob Ruhl

unread,
Jul 8, 2016, 9:01:19 AM7/8/16
to osg-...@lists.openscenegraph.org
Hi,

I did something not too far away from what you are asking last week...

I solved this problem by adding a quad with a color and then the text above it. It is not pretty or flexible but very effective.

See the pick example on how to make a box. I then just added a osgText to it as a child.

Hope this will help you out, at least somewhere to start.

...
Cheers,
Jakob

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=68061#68061

jamie robertson

unread,
Jul 8, 2016, 3:05:44 PM7/8/16
to osg-...@lists.openscenegraph.org
Hi,

There is already support for doing this directly in osgText::Text, for example:


Code:
text->setDrawMode(osgText::TextBase::DrawModeMask::FILLEDBOUNDINGBOX | TextBase::DrawModeMask::TEXT);
text->setBoundingBoxColor(osg::Vec4(0.0f, 0.0f, 0.2f, 0.25f));
text->setBoundingBoxMargin(2.0f);




Cheers,

Jamie[/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=68070#68070
Reply all
Reply to author
Forward
0 new messages