Hi,

ive a few txt files which contains geometry, like: lines, triangles , quads, 
and matrices.
Matrices reffered to sub txt files, which contains also lines quads tris and 
matrices.

i wrote my own loader class 
One txt file will be loaded in a geode.
the loader runs recursively over all files and stored it in a vertex array

Example:


Code:

geode =new osg::Geode(); 
geometry =new osg::Geometry(); 
vertices =new osg::Vec3Array(); 
colors =new osg::Vec4Array(); 

then i put the geometrie data in it 

osg::Vec3f vec[3];
// store geo in vector 

vertices->push_back( osg::Vec3 ( vec[0] ) );
vertices->push_back( osg::Vec3 ( vec[1] ) );
vertices->push_back( osg::Vec3 ( vec[2] ) );
colors->push_back (osg::Vec4 (1.0f, 0.0f, 0.0f, 1.0f)); 
colors->push_back (osg::Vec4 (1.0f, 0.0f, 0.0f, 1.0f)); 
colors->push_back (osg::Vec4 (1.0f, 0.0f, 0.0f, 1.0f)); 


finally :

geometry->setVertexArray (vertices3.get());
geometry->setColorArray (colors3.get()); 
geometry->setColorBinding (osg::Geometry::BIND_PER_VERTEX);     
geometry->addPrimitiveSet(new 
osg::DrawArrays(osg::PrimitiveSet::TRIANGLES,0,triangles)); 




... 

the problem is the performance and the memory 
if i load one file - okay
but in case of many files > 30
i get a incorrect count of vertices ?? ( too much ) 
and the memory raised too much

how can i improve the loader 
or is there a finished loader, which i can rebuild?

Thank you!

Cheers,
Matthias[/code]

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





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

Reply via email to