[osg-users] applying textures

David Callu ledocc at gmail.com
Tue Sep 25 06:13:03 PDT 2007

Hi Enrico

   For a good explanation of texture mapping and texcoord generator, take a
look the redbook
<http://fly.cc.fer.hr/%7Eunreal/theredbook/chapter09.html>and to the
OpenGL Specification, Chap
2.11.4, p 50.  Keep in mind that osg is a c++ wrapper of OpenGL (and little
more of course :-)), and all graphic concep t   come from OpenGL. as the
texcoord generator.


2007/9/25, Enrico Villani <enri.villa at gmail.com>:
> Hi to all!
>    i'm a newbie of osg and i would share my problem with the
> community.......
>     i'm developing a VR application which should load various kind of 3D
> models (mainly flt and osg/ive), insert them into an appropriate
> environement and allow to modify all the scenegraph at runtime. in fact it
> shows the scenegraph and the user can decide to change positions of nodes,
> their visibility, etc. When the user chooses to modify the texture of these
> models, he searches the disk for a good looking image (bmp, jpg, etc), but
> the texture is not mapped correctly (the node selected by the user changes
> only its color, texture too big???? ). otherwise when he applies these
> textures onto the environement sphere or the terrain, all look more or less
> correct. I use an extended nodevisitor to traverse the scenegraph from the
> node choosed by the user in search of geodes. Every time the visitor finds a
> geode it does:
>         int Num = geode.getNumDrawables();
>         for(int j = 0; j < Num; j++) {
>             osg::StateSet* stateset = geode.getDrawable
> (j)->getOrCreateStateSet();
>             osg::Texture2D* myTexture=new osg::Texture2D;
>             myTexture->setDataVariance(osg::Object::DYNAMIC);
>             myTexture->setImage(myImage);
>             stateset->setTextureAttributeAndModes(0, myTexture,
> osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
>             geode.getDrawable(j)->setStateSet(stateset);
>         }
> I'm in trouble understanding texture mapping. I looked at BumpMapping to
> get useful hints about texcoordgenerator... but i don't know how to use it.
> Having multiple geometries, how to map them correctly or even
> approssimatively?
> Can anyone help me??
> Sorry for my maybe silly question but I'm new to to the computer graphics
> world!
> I'd be very grateful..
> Many thanks in advance..
> Enrico
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20070925/b8848db9/attachment-0003.htm>

More information about the osg-users mailing list