Hi Lv,

I haven't tried modifying the drawing style of bounding box of an
osgText::Text before, but it should be possible by decorating the Text
subgraph with an osg::StateSet with the osg::LineStipple and osg::LineWidth
StateAttributes attached to the StateSet to control the stipple and line
width respectively.

The only restriction on doing this with osgText::Text will be that osgText
manages the StateSet of the Text object automatically, to enable the
correct texture to be assigned and to be shared between Text elements.
This means your own osg::StateSet should be assigned to an Node that
decorates the Text object rather that the Text itself.

Robert.

On 27 October 2015 at 16:22, Lv Qing <[email protected]> wrote:

> Hi,
>
> I want to modify text.cpp so can set osgText::BoundingBox's width and line
> Stipple.
>
> Here is how osg draw BOUNDINGBOX in text.cpp:
>
>  if (_drawMode & BOUNDINGBOX)
>     {
>
>         if (_textBB.valid())
>         {
>
> state.applyTextureMode(0,GL_TEXTURE_2D,osg::StateAttribute::OFF);
>
>             const osg::Matrix& matrix =
> _autoTransformCache[contextID]._matrix;
>
>             osg::Vec3
> c00(osg::Vec3(_textBB.xMin(),_textBB.yMin(),_textBB.zMin())*matrix);
>             osg::Vec3
> c10(osg::Vec3(_textBB.xMax(),_textBB.yMin(),_textBB.zMin())*matrix);
>             osg::Vec3
> c11(osg::Vec3(_textBB.xMax(),_textBB.yMax(),_textBB.zMin())*matrix);
>             osg::Vec3
> c01(osg::Vec3(_textBB.xMin(),_textBB.yMax(),_textBB.zMin())*matrix);
>
>
>
> gl.Color4f(colorMultiplier.r()*_textBBColor.r(),colorMultiplier.g()*_textBBColor.g(),colorMultiplier.b()*_textBBColor.b(),colorMultiplier.a()*_textBBColor.a());
>             gl.Begin(GL_LINE_LOOP);
>                 gl.Vertex3fv(c00.ptr());
>                 gl.Vertex3fv(c10.ptr());
>                 gl.Vertex3fv(c11.ptr());
>                 gl.Vertex3fv(c01.ptr());
>             gl.End();
>         }
>     }
>
> I have added this two line before gl.Begin(GL_LINE_LOOP):
>
> glLineWidth (2.0);
> glLineStipple (1, 0x0F0F);
>
> It seems not work,need help!
>
> Thank you!
>
> Cheers,
> Lv
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=65460#65460
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to