Hi Christian, The scene graph nodes are all designed to be reference counted, created objects like you intended to do breaks this and is totally unsafe for memory management. The destructor is deliberately made protected to prevent you from allocating the scene graph objects in an unsafe way - using the compiler to catch your mistakes. You could subclass to get round this but it would be unsafe, you'll end up with crashes.
As for your performance issues, having 10000 auto transforms nodes and text drawables is going to be expensive no matter what you do - on allocation a bit more far more problemantic for cull and draw which will both be very expensive. Perhaps you should consider not using auto transforms and traditional text drawables. You haven't said anything about why you are setting up your scene graph in this way. Perhaps if you explain what your are trying to achieve with your text labels we'll be able to recommend a sensible way forward. Robert. On Fri, Jul 2, 2010 at 11:17 AM, Christian Buchner <[email protected]> wrote: > Hi everybody, > > I am trying to reducing the overhead of dynmically creating 10000 > osg::AutoTransforms that have osgText::Text objects as their > individual children. Turns out the object creation is too slow and > memory intensive. > > So I've tried to embed 10000 osg::AutoTransforms and osgText::Text > objects into another object by means of aggregation, as a quick fix to > this - rather than refactoring the entire application. > > osg::AutoTransform m_MovingMobilesTransform[10000]; > osgText::Text m_MovingMobilesText[10000]; > > Problem is: > > 1>gui\osg_gui.cpp(4836): error C2248: > 'osg::AutoTransform::~AutoTransform' : cannot access protected member > declared in class 'osg::AutoTransform' > 1> C:\Users\Christian Buchner\Documents\Visual Studio > 2010\Projects\SON\deps\OSG\include\osg/AutoTransform(99) : see > declaration of 'osg::AutoTransform::~AutoTransform' > 1> C:\Users\Christian Buchner\Documents\Visual Studio > 2010\Projects\SON\deps\OSG\include\osg/AutoTransform(27) : see > declaration of 'osg::AutoTransform' > > Apparently the AutoTransform destructor is declared virtual and protected. > > Was that done on purpose to prevent object aggregation here? Could I > just create a child of osg::AutoTransform (e.g. MyAutoTransform) and > declare its destructor public to work around this? > > Christian > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

