HI Andreas,

You should set the MaxNumberOfGraphcisContexts to the number of context that you will be using, setting it to any less than this won't save anything other than temporarily as when the rendering it'll need to resize the internal buffers anyway.

osgProducer does the setting of max number of contexts for you, bring it down to a sensible size.  Since you arn't using Producer this won't be happening unless you add your own setting of it.

I would like to refactor the back end of the per graphics context buffers in scene graph elements at some stage, this work would make the need to set max number of graphics context redundent.

Also work on osgViewer will also provide a more cohrent high level support for viewers than rolling your own via SceneView, so it should be able to hide implementation details like MaxNumberOfGraphcisContexts.

Robert.

On 10/6/06, Andreas Ekstrand <[EMAIL PROTECTED]> wrote:
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/

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

Reply via email to