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 

Fix for osg::Program crash


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> Submission
View previous topic :: View next topic  
Author Message
Colin McDonald
Guest





PostPosted: Mon Sep 11, 2017 4:43 pm    Post subject:
Fix for osg::Program crash
Reply with quote

Hi Robert,

If the glCreateProgram in osg::Program fails for any reason, then subsequently
Program::PerContextProgram::linkProgram would crash.  I've put in some
checks to prevent that.

The problem affected fixed-function applications which don't use shaders
themselves, because osgText::Font now tries to create some built-in shaders.
They are created based on compile-time defines (OSG_GL2_AVAILABLE etc),
whereas the display capability for a deployed application at run-time may
not support that.  So we need to handle the glCreateProgram failing.

Attached is an update to src/osg/Program.cpp from the current master branch.

Regards

Colin McDonald

------------------
Post generated by Mail2Forum
Back to top
nadadani
Newbie


Joined: 15 Nov 2017
Posts: 3

PostPosted: Thu Jan 11, 2018 3:00 pm    Post subject:
Reply with quote

Hi all,

my application, based on multiple instances of osgViewer sharing the graphic context and with the possibility of dynamically creating and deleting those osgViewers, was experiencing many crashes with OSG 3.5.x, due to a bug similar to the one described in this Forum, topic number 16745 (sorry, I cannot post links Sad ).

After moving to 3.4.1, the number of crashes decreased a lot, and they are almost absent after applying the patch attached in this thread.

Has it already been integrated to the trunk or is there a "more appropriate way" to handle the problem highlighted by Colin?

Thank you!

Best regards,
Daniele
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12148

PostPosted: Thu Jan 11, 2018 3:19 pm    Post subject:
Fix for osg::Program crash
Reply with quote

Hi Daniele,

On 11 January 2018 at 15:00, Daniele Nadalutti <> wrote:
Quote:
my application, based on multiple instances of osgViewer sharing the graphic context and with the possibility of dynamically creating and deleting those osgViewers, was experiencing many crashes with OSG 3.5.x, due to a bug similar to the one described in this Forum, topic number 16745 (sorry, I cannot post links Sad ).

I would not recommend using multiple instances of osgViewer or sharing
graphics context unless you are restricting the application to just
using SingleThreaded. Creating and destroying viewers is not
something I would recommend either. It's far better to close windows
and stop call frame loops rather than deleting and recreting.

However, I know nothing about your specific application needs so I
can't say exactly what the best approach would be. All I can say is
from your description your usage case does sound like it's designed to
be inefficient and potential unstable, quite a few red flags are
raised.

Quote:
After moving to 3.4.1, the number of crashes decreased a lot, and they are almost absent after applying the patch attached in this thread.

Has it already been integrated to the trunk or is there a "more appropriate way" to handle the problem highlighted by Colin?

There are range of improvements to trunk, whether they address the
crashes you are seeing or not I can't say, issues get reported we fix
them, it's continous cycle with lots of submissions and fixes going
by. All I can say is that your description of your application usage
case raise red flags regardless of what is happening on the OSG side.

I would recommend that you explain to use the particular application
behaviour you are after and we can then recommend how we'd tackle
this.

If it does turn out that your application approach is appropriate and
it's just a bug on the OSG side the best way to progress would be to
create a small test example that illustrates you usage case, as it's
so convoluted as things stand I wouldn't dare trying to infer anything
about what may or may not be wrong with your application or on the OSG
side.

Robert.


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


Joined: 15 Nov 2017
Posts: 3

PostPosted: Thu Jan 11, 2018 4:36 pm    Post subject:
Re: Fix for osg::Program crash
Reply with quote

Hi Robert, thank you for your quick reply.

I provide you with more details about my application.

It is under Windows and it embeds osg::Viewer instances into WindowsForms controls by passing their handles to OSG WindowData objects and using them in the traits of the viewers' graphic contexts.

Such WindowsForms controls are then embedded into standard WindowsForms forms. The user can open/close forms during runtime and all those osgViewer instances share the same Scene.

OSG usage is SingleThreaded, and rendering is disabled when creating/deleting osgViewers (as a consequence of opening/closing forms).

The few remaining crashes that I am experiencing are at driver level.

Thank you very much for your support and best regards,
Daniele
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12148

PostPosted: Thu Jan 11, 2018 4:55 pm    Post subject:
Fix for osg::Program crash
Reply with quote

Hi Daniele,

The way osgViewer is written is for a Viewer/CompositeViewer to be an
application level object that will usually live throughout the life of
the application, it's not something that would be created/destroyed.

If you want to open/close windows then the natural approach with
osgViewer would be to have a osgViewer::CompositeViewer live
throughout the life of the application, then have any windows that you
want to create/destroy be as osgViewer::View's that get
enabled/disabled, and these View's master Camera, or slave Camera
"have a" handle to the appropriate GraphicsWindow. It is better to
enable/disable Views/Camera's rather than to create and destroy them.
When doing compute graphics it's very expensive to create/destroy
graphics objects, it's far better to reuse where possible, this
applies to OpenGL and the OSG.

I have no Windows expertise let alone WindowForms so can't comment on
this specific issues that it introduces. Personally I would much
rather users opt for cross platform solutions rather tie themselves to
a specific OS. A lot of the OSG/OpenGL capabilities and value die the
minute you start tying them to a specific platform. This applies to
any platform, while I use Linux day to day, what I'm really focused on
making real-time computer graphics ubiquitous.

Robert.

On 11 January 2018 at 16:37, Daniele Nadalutti <> wrote:
Quote:
Hi Robert, thank you for your quick reply.

I provide you with more details about my application.

It is under Windows and it embeds osg::Viewer instances into WindowsForms controls by passing their handles to OSG WindowData objects and using them in the traits of the viewers' graphic contexts.

Such WindowsForms controls are then embedded into standard WindowsForms forms. The user can open/close forms during runtime and all those osgViewer instances share the same Scene.

OSG usage is SingleThreaded, and rendering is disabled when creating/deleting osgViewers (as a consequence of opening/closing forms).

The few remaining crashes that I am experiencing are at driver level.

Thank you very much for your support and best regards,
Daniele

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








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


Joined: 15 Nov 2017
Posts: 3

PostPosted: Thu Jan 11, 2018 10:07 pm    Post subject:
Re: Fix for osg::Program crash
Reply with quote

Hi Robert,

thank you again for your support and your precious advice.

I will refactor my code by using CompositeViewer, since you wrote it is the most natural way to use OSG for our purposes.

Those forms and controls I described are currently part of a much bigger framework developed by us, that is is Windows-specific, but I do not exclude that it can become cross platform in the future.

Thank you again and best regards,

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


Joined: 18 Mar 2009
Posts: 12148

PostPosted: Mon Mar 12, 2018 4:01 pm    Post subject:
Fix for osg::Program crash
Reply with quote

Thanks Chris, changes merged and submitted to OSG master.

On 11 September 2017 at 17:42, Colin McDonald <> wrote:
Quote:
Hi Robert,

If the glCreateProgram in osg::Program fails for any reason, then
subsequently
Program::PerContextProgram::linkProgram would crash. I've put in some
checks to prevent that.

The problem affected fixed-function applications which don't use shaders
themselves, because osgText::Font now tries to create some built-in shaders.
They are created based on compile-time defines (OSG_GL2_AVAILABLE etc),
whereas the display capability for a deployed application at run-time may
not support that. So we need to handle the glCreateProgram failing.

Attached is an update to src/osg/Program.cpp from the current master branch.

Regards

Colin McDonald






------------------
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 -> Submission 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 osgText 3.6.3 crash Trajce Nikolov NICK General 2 Wed Sep 12, 2018 12:25 pm View latest post
No new posts Crash when using LineSegmentIntersector sbrkopac General 5 Thu Aug 02, 2018 10:03 pm View latest post
No new posts [Crash issue] no error info even set ... pwang General 1 Sun Jul 29, 2018 1:20 pm View latest post
No new posts [Crash issue] How to add&remove d... pwang General 2 Thu Jul 26, 2018 10:10 am View latest post
No new posts RayIntersector with KdTree causes a c... Ale General 15 Thu Jul 26, 2018 9:33 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