Hi everyone,

I've a Geometry (which is a wall) and I want to put two textures on it. A part 
with a first texture and a second part with a  second texture. 

I wrote the code above :

Code:

    //Texture 1
    geom->setTexCoordArray(0, level->texcoords.get());
    {
      osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;
      osg::ref_ptr<osg::Image> image = 
osgDB::readImageFile("media/textures/stone_3_2048x2048.jpg");
      texture->setImage(image);
      texture->setUnRefImageDataAfterApply(true);
      level->getOrCreateStateSet()->setTextureAttributeAndModes(0, texture);
    }
    //Texture 2
    geom->setTexCoordArray(1, level->texcoords2.get());
    {
      osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;
      osg::ref_ptr<osg::Image> image = 
osgDB::readImageFile("media/textures/Metal_seamless2_ch16.jpg");
      texture->setImage(image);
      texture->setUnRefImageDataAfterApply(true);
      level->getOrCreateStateSet()->setTextureAttributeAndModes(1, texture);
    }




However the wall appears completely black (no textures).

If I comment the "Texture 2" block, the part of the wall with the first texture 
is displayed correctly. And if I comment the "Texture 1" block the part of the 
wall with the second texture is displayed correctly.

I am missing something?

Thank you,
Florian

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=67039#67039





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to