[osg-users] applying textures

Enrico Villani enri.villa at gmail.com
Thu Sep 27 03:29:50 PDT 2007


Thanks for your interest on my problem David, i looked at your link but it
seems too low level... how can i say? i'm only trying to apply a texture to
a model node (thanks to osg scenegraph approach): if i use texgen with
spere_map flag, the texture is applied to my node, but it moves when i move
the camera. if i use eye_linear or object_linear the texture gets black. if
i don't use texgen the node change only its color (assuming the main color
of the texture).

I really need some help!!

Enrico

2007/9/25, David Callu <ledocc at gmail.com>:
>
> 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.
>
> HTH
> david
>
>
> 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
> >
> >
> >
>
> _______________________________________________
> 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/20070927/e10ed167/attachment-0003.htm>


More information about the osg-users mailing list