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 

How to abort rendering


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


Joined: 30 May 2011
Posts: 6

PostPosted: Thu Sep 22, 2011 1:18 pm    Post subject:
How to abort rendering
Reply with quote

Hi all!

I have a problem with rendering. My application always render by demand. When I start camera rotation it render in a draft quality (for better performance), when I stop rotation it start to render in production quality. But in this case application become frozen until end of rendering. Is there any opportunity to abort production rendering if I want to rotate camera again? Or may I render production quality picture in background thread and draw it to screen only when it ready? I mean, my application never should be blocked by rendering.

Thank you!

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


Joined: 18 Mar 2009
Posts: 11311

PostPosted: Thu Sep 22, 2011 2:55 pm    Post subject:
How to abort rendering
Reply with quote

Hi Michael,

There is support in osg::State for setting a pointer to a bool that
you can set to get the drawing traversal to finish without completing
the dispatch of all the objects to be drawn. See the
osg::State::setAbortRenderingPtr(bool*). You can can get the
osg::State object for each GraphicsContext by context->getState();
You can get the list of active contexts from
viewer.getContexts(Contexts&). See the include/osg/State,
include/osg/GraphicsContext and include/osgViewer/Viewer headers for
details of these methods.

I would add that is very old feature that is very rarely used, one I
haven't looked at for nearly a decade so I really don't know whether
it still works or not...

Robert.

On Thu, Sep 22, 2011 at 2:18 PM, Michael Shikin <> wrote:
Quote:
Hi all!

I have a problem with rendering. My application always render by demand. When I start camera rotation it render in a draft quality (for better performance), when I stop rotation it start to render in production quality. But in this case application become frozen until end of rendering. Is there any opportunity to abort production rendering if I want to rotate camera again? Or may I render production quality picture in background thread and draw it to screen only when it ready? I mean, my application never should be blocked by rendering.

Thank you!

Cheers,
Michael

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









------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Bonghi (Claudio Benghi)
Newbie


Joined: 31 Dec 2017
Posts: 2

PostPosted: Sat Jan 06, 2018 9:26 pm    Post subject:
Reply with quote

Hello everybody,

I'm new on the forum, hopefully I'll be able to contribute a bit in the future.

I'm reviving this old thread to ask if the approach suggested is still the best way to manage the interruption of the frame rendering.

The approach I'm considering is to stop the rendering from the RenderBin class if the frame is taking too long to render and the camera has moved.

This would make some elements disappear in some frames, but if the sorting is adequately controlled it might not not disrupt the view much.

I guess I'm trying to implement sort a guaranteed minimum frame rate during manipulation events by dropping elements; is anything like this already implemented?

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


Joined: 18 Mar 2009
Posts: 11311

PostPosted: Mon Jan 08, 2018 2:08 pm    Post subject:
How to abort rendering
Reply with quote

Hi Claudio,

There is an rendering abort feature built into osg::State. You can
have a global bool that you tell osg::State about via
osg::State::setAbortRenderingPtr(&myAbortBool);

This is crude sledge hammer though, it's meant for handling a user
pressing escape or similar abort. Whether this is appropriate for you
usage I can't say.

The alternative would be to implement your own RenderBin variants that
have you won early abort mechanism built in.

However, unless you really really must have this feature and you have
proven beyond doubt that it' absolutely required then I'd suggest just
getting on with developing your application and just making sure it's
efficient rather than jump throw hoops because you think a feature
might be required.

Robert.

On 6 January 2018 at 21:26, Claudio Benghi <> wrote:
Quote:
Hello everybody,

I'm new on the forum, hopefully I'll be able to contribute a bit in the future.

I'm reviving this old thread to ask if the approach suggested is still the best way to manage the interruption of the frame rendering.

The approach I'm considering is to stop the rendering from the RenderBin class if the frame is taking too long to render and the camera has moved.

This would make some elements disappear in some frames, but if the sorting is adequately controlled it might not not disrupt the view much.

I guess I'm trying to implement sort a guaranteed minimum frame rate during manipulation events by dropping elements; is anything like this already implemented?

Thanks,
Claudio

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








------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Bonghi (Claudio Benghi)
Newbie


Joined: 31 Dec 2017
Posts: 2

PostPosted: Mon Jan 08, 2018 10:10 pm    Post subject:
Reply with quote

Thanks Robert,

I've investigated further and by creating a smarter scenegraph I've realised that I won't need to do this; I've achieved good frame rate on a few large models.

For reference of anybody else reading in the future I'll add that the flag that Robert mentions works as advertised, however it only stops the Draw call, so if you have a time-consuming cull() operation the frame will still take some time before it ends.

Thanks again,
Claudio
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 rendering order Gianluca Natale General 0 Mon Oct 23, 2017 5:09 pm View latest post
No new posts Is it possible to clear just certain ... amudhan79 General 3 Mon Sep 11, 2017 7:48 pm View latest post
No new posts Multiple pointlights deferred renderi... antiro42 General 0 Fri Sep 08, 2017 2:39 pm View latest post
No new posts Multi layer effect rendering problem ... not3not4 General 0 Wed Jul 19, 2017 9:44 am View latest post
No new posts Multi-pass rendering segfault issue qiaokun General 0 Mon May 15, 2017 10:36 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