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 

Correct way to modify scene graph [SEC=UNCLASSIFIED]


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Thamm, Russell
Guest





PostPosted: Thu Nov 09, 2017 3:52 am    Post subject:
Correct way to modify scene graph [SEC=UNCLASSIFIED]
Reply with quote

UNCLASSIFIED
Hi

I am in the process of porting an MFC application from plib to osg.

Currently, if I want to actually modify the scene graph (adding, deleting nodes etc) while the render thread is running I do the following:

parentNode->setNodeMask(0);
modify scene graph below parent node
parentNode->setNodeMask(~0);

This seems to work but is there a better way?

Cheers
Russell












IMPORTANT: This email remains the property of the Department of Defence and is subject to the jurisdiction of section 70 of the Crimes Act 1914. If you have received this email in error, you are requested to contact the sender and delete the email.

------------------
Post generated by Mail2Forum
Back to top
moet
User


Joined: 19 Sep 2013
Posts: 27

PostPosted: Thu Nov 09, 2017 4:21 am    Post subject:
Correct way to modify scene graph [SEC=UNCLASSIFIED]
Reply with quote

Hi Russell,
I suppose setting the threading model to SingleThreaded is not an option, maybe set Root Node to DYNAMIC variance? I can't remember the actual call.

good luck,

On 09/11/17 14:49, Thamm, Russell wrote:

Quote:
<![endif]--> <![endif]-->
UNCLASSIFIED
Hi
 
I am in the process of porting an MFC application from plib to osg.
 
Currently, if I want to actually modify the scene graph (adding, deleting nodes etc) while the render thread is running I do the following:
 
parentNode->setNodeMask(0);
modify scene graph below parent node
parentNode->setNodeMask(~0);
 
This seems to work but is there a better way?
 
Cheers
Russell
 
 
 
 
 
 
 
 
 
 
 

IMPORTANT: This email remains the property of the Department of Defence and is subject to the jurisdiction of section 70 of the Crimes Act 1914. If you have received this email in error, you are requested to contact the sender and delete the email.


Quote:
_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12127

PostPosted: Fri Nov 10, 2017 8:53 am    Post subject:
Correct way to modify scene graph [SEC=UNCLASSIFIED]
Reply with quote

Hi Russel,

On 9 November 2017 at 03:49, Thamm, Russell
<> wrote:
Quote:
Currently, if I want to actually modify the scene graph (adding, deleting
nodes etc) while the render thread is running I do the following:

parentNode->setNodeMask(0);

modify scene graph below parent node

parentNode->setNodeMask(~0);

This seems to work but is there a better way?

OpenSceneGraph is quite a different beast to plib so there will be
quite a few advanced scene graphs concepts that you will likely need
to learn as you transition, this can be quite daunting but hopefully
it'll make sense once you work progresses.

The OSG osgViewer frame is broken down and managed in such a way a to
enable multi-threded, multi-graphics context/window/pipe usage, the
update, event traversals are all run from the main thread, it's these
phases of the frame that nodes of the scene graph would be modified.

The rendering traversals phase pairs cull and draw traversals for each
viewer Camera, these may be run SingleThreaded, CullDrawPerContext,
DrawThreadPerContext or CullTheadPerCameraDrawThreadPerContext
threading models (you set this with viewer.setThreadingModel().

For the SingleThreaded and CullDrawThreadPerContext the next frame is
held back till all the geometry and state data has been dispatched
into the OpenGL FIFO, so anything directly after the viewer returns
from viewer.renderingTraversals() you can begin modifying all parts
the scene graph without any worry about other per graphics context
threads running as they will all be iddlying waiting for the next
frame,

For DrawThreadPerContext and CullThreadPerCameraDrawThreadPerContext
threading models the next frame is allowed to commence as soon as all
of the DYNAMIC Geometry and StateSet in the rendering backends data is
dispatched into the OpenGL FIFO. None of the internal nodes of the
scene graph are recorded into the rendering backend data structures so
you can actually modify these as soon as the cull traversal is
complete. In general though one should still just wait till
renderingTraversals is complete before you start modifying - basically
keep things simple where possible, and only try to start to be
"clever" once you know that the defaults aren't going to perform well
enough. For the vast majority of OSG users they don't need to try to
implement extra complicated code to manage scene graph updates.

For you I'd recommend just starting with updating nodes in the update
phases, and if you are updating osg::Geometry or osg::StateSet
contents then simply set the DataVariance property of these objects
you are dynamically updating to DYANMIC so the draw traversal knows to
hold back returning from renderingTraversals() till all these have
been updated.

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Thamm, Russell
Guest





PostPosted: Mon Nov 13, 2017 11:47 pm    Post subject:
Correct way to modify scene graph [SEC=UNCLASSIFIED]
Reply with quote

UNCLASSIFIED
Hi Paul,

Thanks for your response.

The viewer is single-threaded. Furthermore, I now make all modifications to the scene tree in the render thread (prerender) but I still get the occasional crash in the render thread:

C:Program FilesMicrosoft Visual Studio 9.0VCincludevector line 116

Expression(“this->_Has_Container()”, 0)

Unfortunately the error doesn’t occur reliably enough to track down. It does seem to occur when I modify the scene tree.

Cheers
Russell

IMPORTANT: This email remains the property of the Department of Defence and is subject to the jurisdiction of section 70 of the Crimes Act 1914. If you have received this email in error, you are requested to contact the sender and delete the email.

From: Paul Pocock [mailto:]
Sent: Thursday, 9 November, 2017 2:50 p.m.
To: OpenSceneGraph Users; Thamm, Russell
Subject: Re: Correct way to modify scene graph [SEC=UNCLASSIFIED]



Hi Russell,
I suppose setting the threading model to SingleThreaded is not an option, maybe set Root Node to DYNAMIC variance? I can't remember the actual call.
good luck,

On 09/11/17 14:49, Thamm, Russell wrote:
Quote:

UNCLASSIFIED
Hi

I am in the process of porting an MFC application from plib to osg.

Currently, if I want to actually modify the scene graph (adding, deleting nodes etc) while the render thread is running I do the following:

parentNode->setNodeMask(0);
modify scene graph below parent node
parentNode->setNodeMask(~0);

This seems to work but is there a better way?

Cheers
Russell











IMPORTANT: This email remains the property of the Department of Defence and is subject to the jurisdiction of section 70 of the Crimes Act 1914. If you have received this email in error, you are requested to contact the sender and delete the email.



Quote:
_______________________________________________osg-users mailing (
Only registered users can see emails on this board!
Get registred or enter the forums!
)http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12127

PostPosted: Tue Nov 14, 2017 10:22 am    Post subject:
Correct way to modify scene graph [SEC=UNCLASSIFIED]
Reply with quote

Hi Russel,

On 13 November 2017 at 23:45, Thamm, Russell
<> wrote:
Quote:
The viewer is single-threaded. Furthermore, I now make all modifications to
the scene tree in the render thread (prerender) but I still get the
occasional crash in the render thread:

If you are running the viewer SingleThreaded then there isn't a
dedicated rendering thread, there will by just the main application
thread doing update, event, rendering traversals (cull and draw
dispatch).

So are you running single threaded or multi-threaded?

Also why modify the scene graph in rendering traversal?

It's really hard to know what you are doing and why you are doing it.
The only thing I can get a strong impression is that you are doing
something in an odd way and getting a crash.

I would suggest taking a big step back from the problem and explain to
us what you are trying to achieve with updating the scene graph and we
can point you in the right direction of how to do it efficiently.

Robert


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Thamm, Russell
Guest





PostPosted: Fri Nov 17, 2017 12:42 am    Post subject:
Correct way to modify scene graph [SEC=UNCLASSIFIED]
Reply with quote

UNCLASSIFIED
Thanks again Paul,

I am using ref_ptrs but maybe not properly.

I will analyse my code again.

Cheers
Russell

IMPORTANT: This email remains the property of the Department of Defence and is subject to the jurisdiction of section 70 of the Crimes Act 1914. If you have received this email in error, you are requested to contact the sender and delete the email.
From: Paul Pocock [mailto:]
Sent: Tuesday, 14 November, 2017 2:34 p.m.
To: Thamm, Russell
Subject: Re: Correct way to modify scene graph [SEC=UNCLASSIFIED]



Hi Russell, Sill question but are you using ref_ptrs ?

On 14/11/17 10:45, Thamm, Russell wrote:
Quote:

UNCLASSIFIED
Hi Paul,

Thanks for your response.

The viewer is single-threaded. Furthermore, I now make all modifications to the scene tree in the render thread (prerender) but I still get the occasional crash in the render thread:

C:Program FilesMicrosoft Visual Studio 9.0VCincludevector line 116

Expression(“this->_Has_Container()”, 0)

Unfortunately the error doesn’t occur reliably enough to track down. It does seem to occur when I modify the scene tree.

Cheers
Russell

IMPORTANT: This email remains the property of the Department of Defence and is subject to the jurisdiction of section 70 of the Crimes Act 1914. If you have received this email in error, you are requested to contact the sender and delete the email.
From: Paul Pocock [mailto: (
Only registered users can see emails on this board!
Get registred or enter the forums!
)]
Sent: Thursday, 9 November, 2017 2:50 p.m.
To: OpenSceneGraph Users; Thamm, Russell
Subject: Re: Correct way to modify scene graph [SEC=UNCLASSIFIED]



Hi Russell,
I suppose setting the threading model to SingleThreaded is not an option, maybe set Root Node to DYNAMIC variance? I can't remember the actual call.
good luck,

On 09/11/17 14:49, Thamm, Russell wrote:
Quote:

UNCLASSIFIED
Hi

I am in the process of porting an MFC application from plib to osg.

Currently, if I want to actually modify the scene graph (adding, deleting nodes etc) while the render thread is running I do the following:

parentNode->setNodeMask(0);
modify scene graph below parent node
parentNode->setNodeMask(~0);

This seems to work but is there a better way?

Cheers
Russell











IMPORTANT: This email remains the property of the Department of Defence and is subject to the jurisdiction of section 70 of the Crimes Act 1914. If you have received this email in error, you are requested to contact the sender and delete the email.


Quote:
_______________________________________________osg-users mailing (
Only registered users can see emails on this board!
Get registred or enter the forums!
)http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



------------------
Post generated by Mail2Forum
Back to top
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 CompositeViewer with multiple view, a... Angel General 3 Tue Aug 28, 2018 1:15 pm View latest post
No new posts Re-purposing the performance graph bcolbert General 0 Wed Aug 22, 2018 4:52 pm View latest post
No new posts Updating scene properties instead of ... OmegaDoom General 6 Mon Jul 02, 2018 5:34 am View latest post
No new posts Positioning a Camera relative to anot... Takarashy General 0 Thu May 24, 2018 8:27 am View latest post
No new posts Rendering a scene to texture JoseMan General 4 Sun Mar 18, 2018 10:12 am 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