[osg-users] where can i find the vertex positions?

Christian Sam osgforum at tevs.eu
Wed Mar 18 07:19:24 PDT 2009


Hi,

i' m looking for a way to get the vertex positions of my geometry. i know there are methods, provided by osg, to access these vertex positions, but i wanted to get some insight how they are handled by osg, so i debugged a simple scene.

i found the "geometry" object along with the "_primitives" data member, referencing my 5 "DrawArrays" with the correct indexes. the debugger also showed me a "_vertexData" member, but i couldn't find any reference to the actual vertex positions. 

(i set my breakpoint in "viewerbase.cpp" in the ViewerBase::frame() at the eventTraversal() function.)
here is my .osg scene file:

Code:

LOD {
  nodeMask 0xffffffff
  cullingActive TRUE
  Radius -1
  RangeMode DISTANCE_FROM_EYE_POINT
  RangeList 1 {
    0 1e+010
  }
  num_children 1
  Group {
    nodeMask 0xffffffff
    cullingActive TRUE
    num_children 1
    MatrixTransform {
      nodeMask 0xffffffff
      cullingActive TRUE
      StateSet {
        DataVariance STATIC
        rendering_hint DEFAULT_BIN
        renderBinMode INHERIT
        GL_CULL_FACE ON
        GL_LIGHTING OFF
        CullFace {
          mode BACK
        }
      }
      referenceFrame RELATIVE
      Matrix {
        1 0 0 0
        0 1 0 0
        0 0 1 0
        682985 5.21326e+006 0 1
      }
      num_children 1
      Geode {
        nodeMask 0xffffffff
        cullingActive TRUE
        num_drawables 1
        Geometry {
          PrimitiveSets 5
          {
            DrawArrays LINE_STRIP 0 5
            DrawArrays LINE_STRIP 5 5
            DrawArrays LINE_STRIP 10 5
            DrawArrays LINE_STRIP 15 5
            DrawArrays LINE_STRIP 20 5
          }
          VertexArray Vec3Array 25
          {
            218.39 263.092 0
           ...
            -19.3272 -195.515 0
          }
          ColorBinding PER_VERTEX
          ColorArray Vec4Array 25
          {
            0.001251 0.563585 0.193304 1
            ...
            0.808741 0.585009 0.479873 1
          }
        }
      }
    }
  }
}




* where can i find them?

* and whats the prefered way to access them finally in my application? 
i think it can be done both with a visitor (osg::Drawable::AttributeFunctor::apply() like in the osgprerender example), and with a getChild().getVertexArray()

Thanks in advance,
christian

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=8702#8702








More information about the osg-users mailing list