Hi,
I'm a OSG newbie. In this moment i'm trying to apply a texture to a geode.
I've been looking for information on internet and i think i'm following the
right steps, but they don't work to me. Exactly, i'm proceeding in this way:
1. Load a PNG file. According to the debuggin info this step seems to be ok.
osg::Image *image =
osgDB::readImageFile(imageFilePath);
tile->setTexture(image);
2. Create a new texture from the image.
osg::Image *image = tile->getTexture();
osg::Texture2D *texture = new osg::Texture2D(image);
texture->setFilter(osg::Texture2D::MIN_FILTER,
osg::Texture2D::LINEAR_MIPMAP_LINEAR);
texture->setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR);
texture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
texture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
3. Apply the texture to the geode's stateset.
ss.setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON);
I'm implementing a terrain engine algorithm and therefore the geometry is
regenerated on every frame. To achieve this the method "removePrimitiveSet(0)"
is called on every frame. I think it shouldn't imply a problem because and i've
seen other examples that work in a similar way. In any case i have a few
questions on how to apply textures on geometry nodes:
- Is it necessary to specify the coords of the texture?
- Does the texture affect to the whole geometry in the above code? Or Is it
being applied to only one triangle?
I've spent a lot of day (almos five) with this issue. I'll appreciate any
suggestions. Thanks in advance.
______________________________________________
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/