OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

osg::Switch node can't free memory


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
JJLee
Newbie


Joined: 03 May 2016
Posts: 15

PostPosted: Mon May 30, 2016 2:21 am    Post subject:
osg::Switch node can't free memory
Reply with quote

Hi all!

I add a model to the osg::Switch node and set it on. And it goes well in OSG window. But when I turn the switch node to off, the model is invisible while the memory still not free. Can anyone tell me why it happen? Or is there any way that I can hide my model and free memory dynamically?

Thank you!

Cheers,
John
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12144

PostPosted: Mon May 30, 2016 7:08 am    Post subject:
osg::Switch node can't free memory
Reply with quote

Hi John,

The osg::Switch doesn't delete subgraphs when you toggle children
on/off, it simply disables the traversal of the "off" children. A
switch is for switching between one or more children where the change
is not permanent, i.e. children may be switch on/off through the
lifetime of the application.

You can't hide your model and free memory associated with it withought
removing it from the scene graph completely. Group::removeChild() is
the method you want to use.


Robert.

On 30 May 2016 at 03:21, John Lee <> wrote:
Quote:
Hi all!

I add a model to the osg::Switch node and set it on. And it goes well in OSG window. But when I turn the switch node to off, the model is invisible while the memory still not free. Can anyone tell me why it happen? Or is there any way that I can hide my model and free memory dynamically?

Thank you!

Cheers,
John

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








------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
JJLee
Newbie


Joined: 03 May 2016
Posts: 15

PostPosted: Mon May 30, 2016 9:01 am    Post subject:
Reply with quote

Hi robert,

It helps me. Now I load a lot of models in my scene, and each model is a scene node in the scene graph. Is there any method that i can decrease memory usage?

Thank you!

Cheers,
John
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12144

PostPosted: Mon May 30, 2016 10:33 am    Post subject:
osg::Switch node can't free memory
Reply with quote

Hi John,

On 30 May 2016 at 10:02, John Lee <> wrote:
Quote:
It helps me. Now I load a lot of models in my scene, and each model is a scene node in the scene graph. Is there any method that i can decrease memory usage?

Yes.

That's a precise as I can answer at this stage. because you question
is completely open ended.

You really need to tell us what on earth you are trying to achieve in
your application as how best to minimize memory usage depends TOTALLY
on the type of application your are developing, the type of data you
have and the target hardware. We know nothing about this.

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
JJLee
Newbie


Joined: 03 May 2016
Posts: 15

PostPosted: Wed Jun 01, 2016 1:20 am    Post subject:
Re: osg::Switch node can't free memory
Reply with quote

robertosfield wrote:
Hi John,

On 30 May 2016 at 10:02, John Lee <> wrote:
Quote:
It helps me. Now I load a lot of models in my scene, and each model is a scene node in the scene graph. Is there any method that i can decrease memory usage?

Yes.

That's a precise as I can answer at this stage. because you question
is completely open ended.

You really need to tell us what on earth you are trying to achieve in
your application as how best to minimize memory usage depends TOTALLY
on the type of application your are developing, the type of data you
have and the target hardware. We know nothing about this.

Robert.


------------------
Post generated by Mail2Forum


Hi Robert

I am so sorry. In my appliction, I can load a lot of ive models dynamically. When i load about 120 ive models, the memory usage is about 2.5G, and the frame rate about 25-35. Now I want to minimize the memory usage to optimize my application because the camra can't see all objects. Now i don't know how to begin.
I don't know whether you understand. Thank you for your reading and answer.

Jhon.
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12144

PostPosted: Wed Jun 01, 2016 7:46 am    Post subject:
osg::Switch node can't free memory
Reply with quote

Hi John,

On 1 June 2016 at 02:20, John Lee <> wrote:
Quote:
I am so sorry. In my appliction, I can load a lot of ive models dynamically. When i load about 120 ive models, the memory usage is about 2.5G, and the frame rate about 25-35. Now I want to minimize the memory usage to optimize my application because the camra can't see all objects. Now i don't know how to begin.
I don't know whether you understand. Thank you for your reading and answer.

Have a look archives/forum into discussions about osg::ProxyNode and
osg::PagedLOD as these are design for dynamic datasets. With PagedLOD
database you can scale comfortably up to multi-terrabyte databases and
still hit 60Hz. However, it does require you to build an appropriate
PagedLOD hierachy, something that is a more advanced topic.

The other approach is to reduce the size of the individual models you
are loading. You don't say anything about what form these models take
so I can't make any specific suggestions. General suggestions are use
compressed textures, use Vec4ubArray for per vertex colours instead of
Vec4fArray, simply the meshes, use
osg::Texture::setUnrefImageAfterApply(true).

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Switch between primitive and model charlietan789 General 1 Mon Nov 12, 2018 2:25 am View latest post
No new posts Switch call to viewer::frame() betwee... DrPowers General 4 Tue Sep 11, 2018 6:48 am View latest post
No new posts update node in view using cullcallback sirian_ye General 2 Wed Aug 29, 2018 11:40 pm View latest post
No new posts How to track down memory leaks? OmegaDoom General 9 Wed Jul 11, 2018 1:07 pm View latest post
No new posts decent font without free type plugin OmegaDoom General 0 Mon Jun 25, 2018 12:12 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP