Hi Florian, You don't mention how you are setting up your geometry, so don't know if you made a mistake here. You will need texture coordinate arrays for both the 0 and 1 texture unit array slots in osg::Geometry.
Robert Robert. On 2 May 2016 at 06:13, Florian GOLESTIN <florian.goles...@gmail.com> wrote: > 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 > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org