Hi everyone,
I'm afraid I have a very simple question, but I didn't find answer in the
examples or tutorials. Perhaps you can give me a small hint..
I want to add texture to an new osg::Box, and I want to have it repeated. So
I tried:
m_osg_shape = new osg::ShapeDrawable( new osg::Box( osg::Vec3f(
0, 0, -0.005f ), 29.7f, 21.0f, 0.01f ) );
osg::Image* image = osgDB::readImageFile( "gras.jpg" );
osg::Texture2D* tex2d = new osg::Texture2D( image );
tex2d->setWrap( osg::Texture::WRAP_S, osg::Texture::REPEAT );
tex2d->setWrap( osg::Texture::WRAP_T, osg::Texture::REPEAT );
m_osg_shape->getOrCreateStateSet()->setTextureAttributeAndModes(
0, tex2d, osg::StateAttribute::ON );
but the setWrap() command doesn't seem to have any effect for me. I guess I
have to specify the relative alignment for the texture manually but I have
no clue how I do this for a osg::Box. The examples only deal with manuallly
built geoms.
Is there a way to have tiled textures on a osg::Box or will I have to build
my own boxes?
Thanks a lot,
Frans
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org