[osg-users] Optimizer StateVisitor not working

dimi christop dimi_christop at yahoo.com
Fri Sep 26 06:52:21 PDT 2008


Hi,
I am trying to find ways to optimize my scene by removing duplicate StateSets using the Optimizer.
Unfortunately even though I could see inside the osg files (using an editor) duplicate StateSets nothing was shared.
As an example the osg file below although consisting of 2 identical statesets, running the optimizer nothing is shared.
You can simply see that that by just running the osgviewer with this file using the environment variables
OSG_NOTIFY_LEVEL = INFO
OSG_OPTIMIZER = SHARE_DUPLICATE_STATE

osgviewer runs the optimizer by default. It prints out that 2 StateSet were found but none shared!
It also spits out the stats before/after the optimization.
Why ist that? 

Thanks
Dimi


MatrixTransform {
  DataVariance STATIC
  name "TestCube2.xsi"
  nodeMask 0xffffffff
  cullingActive TRUE
  referenceFrame RELATIVE
  Matrix {
    1 0 0 0
    0 -4.37114e-08 1 0
    0 -1 -4.37114e-08 0
    0 0 0 1
  }
  num_children 1
  MatrixTransform {
    name "MDL-cube"
    nodeMask 0xffffffff
    cullingActive TRUE
    referenceFrame RELATIVE
    Matrix {
      1 0 0 0
      0 1 0 0
      0 0 1 0
      0 0 0 1
    }
    num_children 1
    Geode {
      DataVariance STATIC
      name "MSH-cube"
      nodeMask 0xffffffff
      cullingActive TRUE
      num_drawables 2
      Geometry {
        DataVariance STATIC
        StateSet {
          DataVariance STATIC
          rendering_hint DEFAULT_BIN
          renderBinMode INHERIT
          GL_CULL_FACE ON
          GL_LIGHTING ON
          GL_BLEND OFF
          Material {
            ColorMode OFF
            ambientColor FRONT 0.5 0.5 0.5 1
            ambientColor BACK  0.2 0.2 0.2 1
            diffuseColor FRONT 1 1 1 1
            diffuseColor BACK  0.8 0.8 0.8 1
            specularColor FRONT 0 0 0 1
            specularColor BACK  0 0 0 1
            emissionColor FRONT 0 0 0 1
            emissionColor BACK  0 0 0 1
            shininess FRONT 0
            shininess BACK  0
          }
          CullFace {
            mode BACK
          }
          textureUnit 0 {
            GL_TEXTURE_2D ON
            Texture2D {
              name "Priene-Stadio_Ground.rgb"
              file "Priene-Stadio_Ground.rgb"
              wrap_s REPEAT
              wrap_t REPEAT
              wrap_r CLAMP
              min_filter LINEAR_MIPMAP_LINEAR
              mag_filter LINEAR
              maxAnisotropy 1
              borderColor 0 0 0 0
              borderWidth 0
              useHardwareMipMapGeneration TRUE
              unRefImageDataAfterApply TRUE
              internalFormatMode USE_IMAGE_DATA_FORMAT
              resizeNonPowerOfTwo TRUE
            }
          }
        }
        useDisplayList TRUE
        useVertexBufferObjects FALSE
        PrimitiveSets 3
        {
          DrawElementsUShort TRIANGLE_STRIP 4
          {
            1 2 0 3 
          }
          DrawElementsUShort TRIANGLE_STRIP 4
          {
            7 4 6 5 
          }
          DrawElementsUShort TRIANGLE_STRIP 4
          {
            9 10 8 11 
          }
        }
        VertexArray Vec3Array 12
        {
          -4 -4 -4
          -4 4 -4
          4 4 -4
          4 -4 -4
          -4 -4 -4
          4 -4 -4
          4 -4 4
          -4 -4 4
          -4 -4 4
          4 -4 4
          4 4 4
          -4 4 4
        }
        NormalBinding PER_VERTEX
        NormalArray Vec3Array 12
        {
          0 -0 -1
          0 -0 -1
          0 -0 -1
          0 -0 -1
          -0 -1 0
          -0 -1 0
          -0 -1 0
          -0 -1 0
          0 0 1
          0 0 1
          0 0 1
          0 0 1
        }
        TexCoordArray 0 Vec2Array 12
        {
          0 0
          0 1
          1 1
          1 0
          0 0
          1 0
          1 0
          0 0
          0 0
          1 0
          1 1
          0 1
        }
      }
      Geometry {
        DataVariance STATIC
        StateSet {
          DataVariance STATIC
          rendering_hint DEFAULT_BIN
          renderBinMode INHERIT
          GL_CULL_FACE ON
          GL_LIGHTING ON
          GL_BLEND OFF
          Material {
            ColorMode OFF
            ambientColor FRONT 0.5 0.5 0.5 1
            ambientColor BACK  0.2 0.2 0.2 1
            diffuseColor FRONT 1 1 1 1
            diffuseColor BACK  0.8 0.8 0.8 1
            specularColor FRONT 0 0 0 1
            specularColor BACK  0 0 0 1
            emissionColor FRONT 0 0 0 1
            emissionColor BACK  0 0 0 1
            shininess FRONT 0
            shininess BACK  0
          }
          CullFace {
            mode BACK
          }
          textureUnit 0 {
            GL_TEXTURE_2D ON
            Texture2D {
              name "Priene-Stadio_Ground.rgb"
              file "Priene-Stadio_Ground.rgb"
              wrap_s REPEAT
              wrap_t REPEAT
              wrap_r CLAMP
              min_filter LINEAR_MIPMAP_LINEAR
              mag_filter LINEAR
              maxAnisotropy 1
              borderColor 0 0 0 0
              borderWidth 0
              useHardwareMipMapGeneration TRUE
              unRefImageDataAfterApply TRUE
              internalFormatMode USE_IMAGE_DATA_FORMAT
              resizeNonPowerOfTwo TRUE
            }
          }
        }
        useDisplayList TRUE
        useVertexBufferObjects FALSE
        PrimitiveSets 3
        {
          DrawElementsUShort TRIANGLE_STRIP 4
          {
            1 2 0 3 
          }
          DrawElementsUShort TRIANGLE_STRIP 4
          {
            7 4 6 5 
          }
          DrawElementsUShort TRIANGLE_STRIP 4
          {
            9 10 8 11 
          }
        }
        VertexArray Vec3Array 12
        {
          -4 -4 -4
          -4 -4 4
          -4 4 4
          -4 4 -4
          4 -4 -4
          4 4 -4
          4 4 4
          4 -4 4
          -4 4 -4
          -4 4 4
          4 4 4
          4 4 -4
        }
        NormalBinding PER_VERTEX
        NormalArray Vec3Array 12
        {
          -1 0 -0
          -1 0 -0
          -1 0 -0
          -1 0 -0
          1 0 0
          1 0 0
          1 0 0
          1 0 0
          0 1 0
          0 1 0
          0 1 0
          0 1 0
        }
        TexCoordArray 0 Vec2Array 12
        {
          1 0
          0 0
          0 1
          1 1
          1 0
          1 1
          0 1
          0 0
          1 1
          0 1
          0 1
          1 1
        }
      }
    }
  }
}


      



More information about the osg-users mailing list