Hi Martin,

I use the osg::PolygonMode attribute to prevent certain subgraphs from going
into wireframe mode. The following code should work in your case:

osg::PolygonMode *poly = new osg::PolygonMode(
osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::FILL );
label->getOrCreateStateSet()->setAttributeAndModes( poly ,
osg::StateAttribute::ON );

Cheers,
Farshid

On Mon, Mar 29, 2010 at 1:12 PM, Martin Beckett <[email protected]> wrote:

> I have some text labels in my scene, but when I switch the polygon mode (eg
> with the 'w' key in osgviewer) the text is rendered broken (in line mode)
> and dissapears (in point mode). How do I force osg::PolygonMode::FILL, or
> force text to ignore it?
>
> I tried:
>
> Code:
>
> label->getOrCreateStateSet()->setMode(GL_POLYGON_MODE,
> osg::StateAttribute::ON);
>
>
>
>
> My text creation code is:
>
> Code:
> // creates text label correctly
> osg::ref_ptr<osgText::Text>label =new osgText::Text;
> label->setFontResolution(32,32);
> label->setCharacterSize(textSize);
> label->setCharacterSizeMode(osgText::Text::SCREEN_COORDS);
> label->setAxisAlignment(osgText::Text::XY_PLANE);
> label->setAlignment(osgText::Text::RIGHT_BOTTOM);
> label->setColor(osg::Vec4(1.0f,1.0f,0.0f,1.0f));
> label->setPosition(osg::Vec3f(x,y,z));
>
>
>
>
> Cheers,
> Martin
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=26251#26251
>
>
>
>
>
> _______________________________________________
> 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