On Mon, 2011-05-23 at 19:02 +0200, daniele argiolas wrote:
> Hi,
> is there a way to put a semitransparent image in a widget?
> 
> I build my widget as:
> 
> 
> Code:
>  
>   widget = new osgWidget::Widget(imageSrc,notifySize[0],notifySize[1]);
>   widget->setColor(1.0,1.0,1.0,1.0);
>   widget->setImage(imageSrc);
>   widget->setSize(notifySize);
>   widget->setTexCoord(0.0f, 0.0f, osgWidget::Widget::LOWER_LEFT);
>   widget->setTexCoord(1.0f, 0.0f, osgWidget::Widget::LOWER_RIGHT);
>   widget->setTexCoord(1.0f, 1.0f, osgWidget::Widget::UPPER_RIGHT);
>   widget->setTexCoord(0.0f, 1.0f, osgWidget::Widget::UPPER_LEFT);
>   widget->setAlignHorizontal(osgWidget::Widget::HA_CENTER);
>   widget->setAlignVertical(osgWidget::Widget::VA_CENTER);
>   widget->setLayer(osgWidget::Widget::LAYER_TOP );

You're doing everything right except one small thing, which I will be
changing in future versions of osgWidget. The transparency is working,
but the background widget of the Window you put your Widget in is
probably full white. So:

Window->getBackground()->setColor(0, 0, 0, 0);

...and you should be good. :)

> imageSrc is a PNG transparent file, but I can't see the trasparence.
> 
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=39637#39637
> 
> 
> 
> 
> 
> _______________________________________________
> 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