On Fri, 2008-10-10 at 17:58 +0200, Christian Heine wrote:
> Hi folks,
> 
> I'm actually integrate osgWidget as GUI library in our engine. I know
> it's beta status, but it's pure OSG and we think a better solution
> than other third libraries like CEGUI.
>
> My first test are working well. Now i try to extend simple things,
> i.e. add a mechanism to set textures for the widgets. I got the
> problem that i couldn't define a texture for a Label, which is an
> extension of the main widget class.
> 
> This code snippet works well on a osgWidget::Widget:
> 
> osgWidget::Widget* left   = new osgWidget::Widget("left");
> left->addSize(300.0f, 42.0f);
> left->setImage  ("gfx/tga/bar.tga", false);
> left->setCanFill(true);
> left->setTexCoord(0.0f, 0.0f, osgWidget::Widget::LOWER_LEFT);
> left->setTexCoord(1.0f, 0.0f, osgWidget::Widget::LOWER_RIGHT);
> left->setTexCoord(1.0f, 1.0f, osgWidget::Widget::UPPER_RIGHT);
> left->setTexCoord(0.0f, 1.0f, osgWidget::Widget::UPPER_LEFT);
> m_container->addWidget(left);

You shouldn't have to manually set the texture coordinates like that if
you don't want; you could use ->setImage("...", true) with the right Y
setting in the WindowManager and it should behave how you want. Either
way is fine, though. :)

> But when i change the initialization to an osgWidget::Label instance,
> i got the label without any texture. Is this a known bug?

I don't think there's a bug. Try calling:

        left->setColor(1.0f, 1.0f, 1.0f, 1.0f);

...and it should be just fine. Be default, a Label object sets it's
Widget color to be completely transparent, so I'm guessing the texture
is there just not visible (or rather, it's alpha is 0.0f).

> I think it should be possible to define a textured background for a
> label while you could define the label as semi or non transparent...
> 
> Best regards,
> Christian
> 
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 

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

Reply via email to