Jean-Sébastien Guay wrote:
>>             m_osg_shape = new osg::ShapeDrawable( new osg::Box( 
>> osg::Vec3f( 0, 0, -0.005f ),  29.7f, 21.0f, 0.01f ) );
>>...
>>
>> 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.
> 
> The wrap modes only take effect if your geometry has texture coordinates 
> outside the 0.0 - 1.0 range. In the case of the osg::Box shapedrawable, 
> it generates texcoords that go from 0.0 to 1.0 on each face, in both the 
> s and t directions. So you'll never see wrapping on that.
> 
> You'll have to make your own box, and specify the texture coordinates 
> you want. For example 0.0 - 2.0 on each axis for each face will give you 
> a texture repeated twice (assuming you set up your texture as above). 

You could also assign a texture matrix that scales the texture coordinates to 
something useful for your purposes:

osg::TexMat* tm = new osg::TexMat;
tm->setMatrix(osg::Matrix::scale(2,2,2));

m_osg_shape->setAttributeAndModes(tm, osg::StateAttribute::ON);

However, doing your own box also gives you more control over how texture coords 
are assigned so you may want to do that in the end anyway...

/ulrich
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to