[osg-users] osg::Texture and stateSets

65 views
Skip to first unread message

ka Ming

unread,
Jul 9, 2008, 10:53:21 AM7/9/08
to osg-...@lists.openscenegraph.org
Hi,
I got a Probel with osg Files, the File structure looks like:
Group{
    Geode{
        Geometry{
            StateSet{
                Texture{
                }
            }
        }
    }   
    Geode{
        Geometry{
            StateSet{
                Texture{
                }
            }
        }
    }
}
The problem is if I try to traverse my SceneGraph I get the names of my geodes, but if I check the TextureAttributeList
osg::StateSet::TextureAttributeList texAttrList = stateSet-> getTextureAttributeList();
this list is empty. Why is this List empty, did I forget something? I want to access all Textures!!
Thanks
Ming



Gesendet von Yahoo! Mail.
Dem pfiffigeren Posteingang.

冯晨

unread,
Jul 9, 2008, 10:28:30 PM7/9/08
to OpenSceneGraph Users
 
 
 Hi,
    I think osgUtil::optimizer::TextureVisitor should solve your problem....:)
    Good luck.


网易首款免费3D网游“天下2”,6月6日激情公测

ka Ming

unread,
Jul 10, 2008, 8:48:48 AM7/10/08
to osg-...@lists.openscenegraph.org
Hi,
I am already looked at the optimizer.
But still I cannot access my Texture ;(.
stateset.getTextureAttributeList() is always null. Why?
I can call the geode Name. I can call the Geometry - but no Texture!!!

My OSG File:

Geode {
  DataVariance DYNAMIC
  name "cube.osg"
  nodeMask 0xffffffff
  cullingActive TRUE
  num_drawables 6
  Geometry {
    DataVariance DYNAMIC
    StateSet {
      DataVariance DYNAMIC
      rendering_hint OPAQUE_BIN
      renderBinMode INHERIT
      GL_CULL_FACE OFF
      GL_LIGHTING ON
      textureUnit 0 {
        GL_TEXTURE_2D ON
        Texture2D {
          DataVariance STATIC
          file "images.jpg"
          wrap_s CLAMP
          wrap_t CLAMP
          wrap_r CLAMP
          min_filter LINEAR_MIPMAP_LINEAR
          mag_filter LINEAR
          maxAnisotropy 1
          useHardwareMipMapGeneration TRUE
          unRefImageDataAfterApply FALSE
          internalFormatMode USE_IMAGE_DATA_FORMAT
        }
      }
    }
..........

Some Ideas??


冯晨 wrote:



_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Stephan Maximilian Huber

unread,
Jul 10, 2008, 9:38:14 AM7/10/08
to OpenSceneGraph Users
ka Ming schrieb:

> I am already looked at the optimizer.
> But still I cannot access my Texture ;(.
> stateset.getTextureAttributeList() is always null. Why?
> I can call the geode Name. I can call the Geometry - but no Texture!!!
>
Your texture is part of a stateset attached to the Geometry not to the
Geode. query the geometry for the stateset and not the geode.

Cheers,
Stephan

Alberto Luaces

unread,
Jul 10, 2008, 11:51:44 AM7/10/08
to OpenSceneGraph Users
Hi,

El Jueves 10 Julio 2008ES 14:48:48 ka Ming escribió:
> Hi,
> I am already looked at the optimizer.
> But still I cannot access my Texture ;(.
> stateset.getTextureAttributeList() is always null. Why?
> I can call the geode Name. I can call the Geometry - but no Texture!!!
>

I'm having a similar problem. First I developed my own visitor, but then I
used osgUtil::Optimizer::TextureVisitor, but the method apply(osg::Texture
&texture) is never called. Short code below:

class ImageVisitor2: public osgUtil::Optimizer::TextureVisitor
{
public:
std::set<osg::Image*> images;

ImageVisitor2(): osgUtil::Optimizer::TextureVisitor(true, true, true,
true, true, 0.0)
{}
void apply(osg::Texture &texture)
{
images.insert(texture.getImage(0));
}
void escribirImagenes()
{
for_each(images.begin(), images.end(), imagenToDisk);
}
};

Reply all
Reply to author
Forward
0 new messages