Hi,

I'm trying to minimize the memory consumption of my 12 000 osgText::Text objects. I noticed that some of the members of the class (and the classes it uses) are buffered, i.e. there is one copy of the member per available graphic context. This means that at least on my system there are 32 copies of each of these members, causing the memory consumption to rise substantially, even if I only use one context.

To avoid this, I tried to call osg::DisplaySettings::instance()->setMaxNumberOfGraphicsContexts(1) temporarily when creating my osgText::Text objects and then set it back to its original value. As expected it cut away a lot of the allocated memory and everything worked fine. I have implemented a subclass of osgText::Text which overrides setPosition and only calls computePositions with the graphic context IDs currently used, to gain some (or actually a lot) performance when creating the text objects. Thanks to this (I guess), it even works fine now if I have several viewports with different graphic contexts.

My question is, do I risk something doing it this way? It does feel a bit like cheating... I mean, the text positions are calculated for each graphic context, but there is only one copy each of the buffered members of my text objects. Is it a good or bad idea to do this to save memory?

Regards,
Andreas Ekstrand

--
________________________________________________________________________
Andreas Ekstrand
Remograph
Rekrytgatan 10
SE-582 14 Linköping
SWEDEN
Website: http://www.remograph.com
E-mail: [EMAIL PROTECTED]

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to