<div dir="ltr"><div><div>Hi Florian,<br><br></div>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.<br><br></div><div>Robert<br></div><div><br></div>Robert.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 2 May 2016 at 06:13, Florian GOLESTIN <span dir="ltr"><<a href="mailto:florian.golestin@gmail.com" target="_blank">florian.golestin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi everyone,<br>
<br>
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.<br>
<br>
I wrote the code above :<br>
<br>
Code:<br>
<br>
//Texture 1<br>
geom->setTexCoordArray(0, level->texcoords.get());<br>
{<br>
osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;<br>
osg::ref_ptr<osg::Image> image = osgDB::readImageFile("media/textures/stone_3_2048x2048.jpg");<br>
texture->setImage(image);<br>
texture->setUnRefImageDataAfterApply(true);<br>
level->getOrCreateStateSet()->setTextureAttributeAndModes(0, texture);<br>
}<br>
//Texture 2<br>
geom->setTexCoordArray(1, level->texcoords2.get());<br>
{<br>
osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;<br>
osg::ref_ptr<osg::Image> image = osgDB::readImageFile("media/textures/Metal_seamless2_ch16.jpg");<br>
texture->setImage(image);<br>
texture->setUnRefImageDataAfterApply(true);<br>
level->getOrCreateStateSet()->setTextureAttributeAndModes(1, texture);<br>
}<br>
<br>
<br>
<br>
<br>
However the wall appears completely black (no textures).<br>
<br>
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.<br>
<br>
I am missing something?<br>
<br>
Thank you,<br>
Florian<br>
<br>
------------------<br>
Read this topic online here:<br>
<a href="http://forum.openscenegraph.org/viewtopic.php?p=67039#67039" rel="noreferrer" target="_blank">http://forum.openscenegraph.org/viewtopic.php?p=67039#67039</a><br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</blockquote></div><br></div>