Hi Vincent,

I'm not sure how other people could help you here - its very much a
question that doesn't have enough information about the problem to
know what an appropriate answer might be.

Texture coordinate generation in OpenGL is an awkward topic, and the
best I can recommend is that you dive into books or online texts that
discuss it.  The OSG for the most part basically just does a direct
pass through of settings you make on OSG objects when pass the values
to OpenGL so OpenGL docs should serve you well.

Robert.

On Tue, Apr 29, 2008 at 9:51 AM, Vincent Bourdier
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> With some new tests, I've something different as you can see in the attached
> file
>
> I use this code
>
> >
> > osg::TextureCubeMap* texcube = new osg::TextureCubeMap();
> >
> >     osg::Image* white = createWhiteImage(_x,_y);
> >
> >     texcube->setImage(osg::TextureCubeMap::POSITIVE_X, white);
> >     texcube->setImage(osg::TextureCubeMap::NEGATIVE_X, white);
> >     texcube->setImage(osg::TextureCubeMap::POSITIVE_Y, white);
> >     texcube->setImage(osg::TextureCubeMap::NEGATIVE_Y, white);
> >
> >     texcube->setImage(osg::TextureCubeMap::POSITIVE_Z, _texGrad.get());
> >     texcube->setImage(osg::TextureCubeMap::NEGATIVE_Z, white);
> >
> >  osg::TexGen *tg = new osg::TexGen;
> >  tg->setMode(osg::TexGen::OBJECT_LINEAR);
> >
> > geode->getOrCreateStateSet()->setTextureAttributeAndModes(0, tg,
> osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON);
> >
> >
> > geode->getOrCreateStateSet()->setTextureAttributeAndModes(0, texcube,
> osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE);
> >
>
> Any idea of how to obtain a good mapping ?
>
> In the picture we can see 6 face or the TextureCubeMap, but how to put it a
> the good size ?
>  Have you already used TextureCubeMap ? or how can you did the mapping on a
> "face" of a geode ?
>
> Thanks a lot,
>
> Regard.
>    Vincent.
>
> 2008/4/25 Vincent Bourdier <[EMAIL PROTECTED]>:
>
>
>
> > Hi all,
> >
> > Attempting to put a texture on a geode, (a texture computed in real time)
> I've used osg::TextureCubeMap, which look good to do this with my data...
> but I have problems with the correct mapping:
> >
> > In the attached file you can see
> > 1. the texture
> > 2. the node with this texture
> >
> > As you can see, it looks like nothing ...
> >
> > I use this code to obtain this result :
> >
> >
> >
> > >     osg::TextureCubeMap* texcube = new osg::TextureCubeMap();
> > >     texcube->setImage(osg::TextureCubeMap::POSITIVE_X, _texGrad.get());
> > >     texcube->setImage(osg::TextureCubeMap::NEGATIVE_X, _texGrad.get());
> > >     texcube->setImage(osg::TextureCubeMap::POSITIVE_Y, _texGrad.get());
> > >     texcube->setImage(osg::TextureCubeMap::NEGATIVE_Y, _texGrad.get());
> > >     texcube->setImage(osg::TextureCubeMap::POSITIVE_Z, _texGrad.get());
> > >     texcube->setImage(osg::TextureCubeMap::NEGATIVE_Z, _texGrad.get());
> > >
> > >
> > >     osg::TexMat* texmat = new osg::TexMat;
> > >     texmat->setScaleByTextureRectangleSize(true);
> > >     geode->getOrCreateStateSet()->setTextureAttributeAndModes(0, texmat,
> osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE);
> > >
> > >     geode->getOrCreateStateSet()->setTextureAttributeAndModes(0,
> texcube, osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE);
> > >
> >
> > Wrapping seems to do nothing... TextureRectangle depends of the geometry
> vertices ans edges...
> >
> > If you have any idea, I'll be happy to hear you.
> >
> > Thanks.
> >
> > Regards,
> >    Vincent.
> >
>
>
> _______________________________________________
>  osg-users mailing list
>  osg-users@lists.openscenegraph.org
>  http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to