[osg-users] how to set width and Stipple of a osgText::BoundingBox?

Lv Qing donlvqing at msn.com
Tue Oct 27 09:22:02 PDT 2015


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








More information about the osg-users mailing list