Robert,

We haven't touched the MaxNumberOfGraphcisContexts before but it's set to 32 by default in osg::DisplaySettings. However, we aren't using multi-threading but we are using several viewports with their own unique graphic contexts. We keep track of these context IDs ourselves and feed them to the SceneViews of the viewports. Is it still okay to set MaxNumberOfGraphcisContexts to 1?

/Andreas

Robert Osfield wrote:

HI Andreas,

Why is the value of MaxNumberOfGraphcisContexts so high? How many graphics contexts do you ever expect to need? I wouldn't set the value to lower than this otherwise you could end up with threading issues. If you arn't using multi-threading of the scene graph then this isn't something to worry about, and you can set the MaxNumberOfGraphcisContexts to 1 quite safely as the structure themseles should automatically resize.

Robert.


On 10/6/06, *Andreas Ekstrand* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    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]
    <mailto:[EMAIL PROTECTED]>

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


------------------------------------------------------------------------

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



--
________________________________________________________________________
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