Hi Pablo,
What is missing from your code is the generate of texture coordinates.
The way to do this is to use a TexGenNode to positioning the mapping
between vertex position to texture coordinates.
Robert.
On Tue, Aug 26, 2008 at 1:54 PM, Pablo Perez <[EMAIL PROTECTED]> wrote:
> This is the part of osgviewer where I try to load the new texture:
>
> osg::Group* root = new osg::Group();
>
> osg::ref_ptr<osg::Node> loadedModel =
> osgDB::readNodeFile("C:\\osg\\Terrain.ive");
> osg::Image* loadedImage = osgDB::readImageFile( "C:\\OSG\\overlay.png" );
> osg::Texture2D* texture = new osg::Texture2D(loadedImage);
> loadedModel->getOrCreateStateSet()->setTextureAttributeAndModes(1,texture,
> osg::StateAttribute::ON);
> loadedModel->getOrCreateStateSet()->setTextureMode(1,
> GL_TEXTURE_2D,osg::StateAttribute::ON);
>
> root->addChild(loadedModel.get());
>
> 2008/8/26 Pablo Perez <[EMAIL PROTECTED]>
>>
>> Hi Robert,
>>
>> I´m trying to overlay another texture ontop of the existing tiles. I´m
>> working
>> in a GIS and I want to add layers like highways,.... from a WMS.
>>
>> Thanks,
>>
>> Pablo
>>
>>
>> 2008/8/26 Robert Osfield <[EMAIL PROTECTED]>
>>>
>>> Hi Pablo,
>>>
>>> >From your email I can't quite work out what you are trying to achieve.
>>> Is that you want to replace the existing texture present in each
>>> tile that is loaded, or overlay another texture ontop of the existing
>>> tiles?
>>>
>>> Robert.
>>>
>>> On Tue, Aug 26, 2008 at 12:18 AM, Pablo Perez <[EMAIL PROTECTED]> wrote:
>>> > Hi,
>>> >
>>> > I have built a PageLOD terrain database with osgdem and now I want to
>>> > modify
>>> > osgviewer to add diferents images for each terrain tile and LOD. I try
>>> > to
>>> > add a texture2D to the root->getChild Node but only can see the
>>> > texture2D in
>>> > the areas where there aren´t terrain images.
>>> >
>>> > _______________________________________________
>>> > osg-users mailing list
>>> > [email protected]
>>> >
>>> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>> >
>>> >
>>> _______________________________________________
>>> osg-users mailing list
>>> [email protected]
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org