[osg-users] how to set width and Stipple of a osgText::BoundingBox?
Robert Osfield
robert.osfield at gmail.com
Tue Oct 27 10:17:18 PDT 2015
Hi Lv,
osgText::Text implementation is very pretty old now, with a design driven
by the needs of very old hardware. If I were to rewrite osgText I would
not implement it the has been. I would not recommend adding OpenGL coding
into osgText::Text as this breaks OSG's ability to do lazy state updating.
Robert.
On 27 October 2015 at 16:48, Lv Qing <donlvqing at msn.com> wrote:
> Thx!Robert!
>
> The situation is,we have modified the text.cpp to create some other
> styles rather than boundingbox.
>
> Like a BoundingLine,one end to one of the corner of a BoundingBox,the
> other end linked to a osg::Node.
>
> So if a text have a BoundingLine and a BoundingBox,I just want draw the
> BoundingBox as normal,but draw the BoundingLine with LineStipple .So I
> think one osg::StateSet may not solve this problem.
>
> I am not quiet familiar with the openGL programming since I use osg at
> first.I search the web found people use this code to set
> Linewidth and Stipple
>
> glLineWidth (2.0);
> glLineStipple (1, 0x0F0F);
>
> And I look into text.cpp,found lots of code like use openGL directly,such
> as :
>
> //glClear(GL_STENCIL_BUFFER_BIT);
>
> // enable stencil buffer
> glEnable(GL_STENCIL_TEST);
>
> // write a one to the stencil buffer everywhere we are about to draw
> glStencilFunc(GL_ALWAYS, 1, 1);
>
> // write only to the stencil buffer if we pass the depth test
> glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
>
> // Disable writing to the color buffer so we only write to the stencil
> // buffer and the depth buffer
> glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
>
> // make sure the depth buffer is enabled
> // glEnable(GL_DEPTH_TEST);
> // glDepthMask(GL_TRUE);
> // glDepthFunc(GL_LESS);
>
> // Arrrgh! Why does the code only seem to work correctly if I call
> this?
> glDepthMask(GL_FALSE);
>
>
>
> So I think use the openGL code to draw different style may be the qucik
> way.
>
>
>
>
> ...
>
> Thank you!
>
> Cheers,
> Lv
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=65462#65462
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20151027/4a37a1da/attachment-0003.htm>
More information about the osg-users
mailing list