Hi Christain,

ShapeDrawable doesn't support repeating of texture coordinates.  The
closest you could get is to use osg::TexMat, but in the end I think
it'd be easier just to create the geometry yourslef as you need it.

Robert.

On 3/21/07, Christian Verbeek <[EMAIL PROTECTED]> wrote:
Dear osg-users,

I want to create a floor textured with a small image being repeated.
Thats what I am doing, but the texture is stretched (i.e shown only
once). What is wrong? I am using the latest OSG version from SVN.

osg::Texture2D* gridTexture = new osg::Texture2D;
osg::Image* gridFace = osgDB::readImageFile("grid_grey.png");
gridTexture->setImage(gridFace);
gridTexture->setFilter( osg::Texture::MIN_FILTER,
osg::Texture::LINEAR_MIPMAP_LINEAR );
gridTexture->setFilter( osg::Texture::MAG_FILTER, osg::Texture::LINEAR );
gridTexture->setWrap  ( osg::Texture::WRAP_S, osg::Texture::REPEAT );
gridTexture->setWrap  ( osg::Texture::WRAP_T, osg::Texture::REPEAT );
osg::StateSet* gridState = new osg::StateSet();
gridState->setTextureAttributeAndModes(
0,gridTexture,osg::StateAttribute::ON );

osg::Group* root = new osg::Group();

osg::Box* unitCube = new osg::Box( osg::Vec3(0,0,0), 1000, 1000, 0.1);
osg::ShapeDrawable* unitCubeDrawable = new osg::ShapeDrawable(unitCube);
osg::Geode* basicShapesGeode = new osg::Geode();
basicShapesGeode->addDrawable(unitCubeDrawable);
basicShapesGeode->setStateSet( gridState );
root->addChild(basicShapesGeode);


Regards
Christian

--
___________________________________________
Dr. Christian Verbeek
Geschäftsführer

Postanschrift:
REC GmbH, Gebelestraße 22a, 81679 München

Tel:    +49 89 45237829
Mobile: +49 160 7056589
e-mail: [EMAIL PROTECTED]

Geschäftsführer: Prof. Dr. Alois Knoll, Dr. Christian Verbeek
Registergericht: AG München (HRB 154463)
____________________________________________


_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to