Yes, that solved the problem. Many thanks, you both!

I'm posting the code, for reference.

    osg::ref_ptr<osg::StateSet> stateSet(root->getOrCreateStateSet());
    osg::Image* image = new osg::Image;
    // allocate the image data, noPixels x 1 x 1 with 4 rgba floats -
equivilant to a Vec4!
    int noPixels = 1;
    image->allocateImage(noPixels,1,1,GL_RGBA,GL_FLOAT);
    image->setInternalTextureFormat(GL_RGBA);
    // fill in the image data.
    osg::Vec4* dataPtr = (osg::Vec4*)image->data();
    osg::Vec4 color(1,1,1,1);
    *dataPtr = color;
    // make fake texture
    osg::Texture2D* fakeTex = new osg::Texture2D;
    fakeTex->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP_TO_EDGE);
    fakeTex->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP_TO_EDGE);
    fakeTex->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
    fakeTex->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
    fakeTex->setImage(image);
    // add fake texture
    stateSet->setTextureAttribute(0,fakeTex,osg::StateAttribute::ON);
    stateSet->setTextureMode(0,GL_TEXTURE_1D,osg::StateAttribute::OFF);
    stateSet->setTextureMode(0,GL_TEXTURE_2D,osg::StateAttribute::ON);
    stateSet->setTextureMode(0,GL_TEXTURE_3D,osg::StateAttribute::OFF);


2008/11/3 Jean-Sébastien Guay <[EMAIL PROTECTED]>

> Hello Jefferson,
>
>  Can you tell me, please, how to set a default texture for the root?
>>
>
> See src/osgShadow/ShadowMap.cpp around line 290, which starts with this
> comment:
>
>    // fake texture for baseTexture, add a fake texture
>    // we support by default at least one texture layer
>    // without this fake texture we can not support
>    // textured and not textured scene
>
> You can set this 1x1 white texture at the root of your graph, and if any
> node has a different texture on unit 0 it will override it automatically.
>
> Hope this helps,
>
>
> J-S
> --
> ______________________________________________________
> Jean-Sebastien Guay    [EMAIL PROTECTED]
>                               http://www.cm-labs.com/
>                        http://whitestar02.webhop.org/
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
Jefferson Pinheiro
(51) 9192 3535
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to