Hi,
You'll need to attach texture coordinates to your geometry, unless you
use osg::TexGen/osg::TexGenNode to generate the texture coordiantes
for you.
When do dynamic geometry its important to switch off display lists via
geometry->setUseDisplayList(false);
Finally, your terrain engine, do you really need to compute stuff on
the fly? Static geometry will typically be much faster, and use of
LOD's and database paging can balance the load and allow you to really
scale up the terrain to billions of polygons.
Robert.
On 2/14/07, Ignacio José López Rodríguez <[EMAIL PROTECTED]> wrote:
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/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/