Hi Roy

 There is an osgClearNode, that might be what you want, but this works for
me.

osg::Geode* createNodeWithMyImageOnIt(const std::string& filename)
{
osg::Geode* geode = new osg::Geode;
osg::Geometry* geometry =
osg::createTexturedQuadGeometry(osg::Vec3(0,0.5,0),osg::Vec3(1,0,0),osg::Vec3(0,0,1),0,
0, 1, 1);
geode->addDrawable(geometry);
osg::Texture2D* texture = new
osg::Texture2D(osgDB::readImageFile(filename));
geode->getOrCreateStateSet()->setTextureAttributeAndModes(0,texture,
osg::StateAttribute::ON);
geode->getOrCreateStateSet()->setTextureMode(0,
GL_TEXTURE_2D,osg::StateAttribute::ON);
//geode->getOrCreateStateSet()->setMode(GL_LIGHTING,
osg::StateAttribute::OFF);
return geode;
}

void Cockpit::Drawgauges()
{
osg::Projection* Proj = new osg::Projection;
Proj->setMatrix(osg::Matrix::ortho2D(0,1,0,1));
osg::Geode* backgroundImage = createNodeWithMyImageOnIt("imagefile");
m_CockpitGroup->addChild(Proj);
Proj->addChild(backgroundImage);

Brgs.

Ralf Stokholm

2009/5/18 roy vardi <royva...@walla.co.il>

> Hi guys (and girls...),
>
> I'm new with the OSG.
> I'm creating a basic model, and for the past couple of hours have tried
> without success to set a loaded image as the model's background, instead of
> the default one (the blue color).
> I know that there is a camera function which can change the background
> color, but it only supports an RGB coordinates input.
> Is there an easy way to just set an image as the background?
>
> Thank you!
>
> Cheers,
> roy
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=12355#12355
>
>
>
>
>
> _______________________________________________
> 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