Hi Frans, If you want fine grained control over rendering then osg::Box/osg::ShapeDrawable are not the things to use. osg::Box is really just a shape primitive that exist to support mathematical primitives used in physics engines. ShapeDrawable does allow you to render these shapes but its just a convenience class that isn't intended for general purpose rendering or high performance.
For full control I'd recommend creating the geometry using osg::Geometry, see the osggeometry example for details. Robert. On Thu, Feb 14, 2008 at 7:31 AM, Frans Fürst <[EMAIL PROTECTED]> wrote: > 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->getOrCreateStateSe > t()->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 > > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

