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 

[Crash issue] How to add&remove drawable (geometry) property.


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


Joined: 26 Jul 2018
Posts: 6

PostPosted: Thu Jul 26, 2018 10:10 am    Post subject:
[Crash issue] How to add&remove drawable (geometry) property.
Reply with quote

Hi,
I am doing them real-time rendering application development with Qt + OSG.
I created several threads to create new Geometry and in GUI - main threads, try to remove the old one and add new ones.

1, already set node and geometry to user dynamic.
geometry->setDataVariance(osg::Object::DYNAMIC)
geode_->setDataVariance(osg::Object::DYNAMIC);
2, already used osg smart point everywhere.
3, geometry is created in other threads. and post to a global queue.
4, in Main thread. PaintGL event will add&remove geometry in "autoAddRemove" function.
void OSGMeshRender::paintGL() {
autoAddRemove();
viewer_->frame();
}
5, the setup work for qt+osg is almost same like this blog, nothing speical.
vicrucann.github.io/tutorials/cmake-qt-osg-1/


I got below crash sometimes when I add&remove drawable.

0000082`873ba218 : nvoglv64+0x927b51
00000075`2b19bf61 : osg156_osgrd!osg::GLBufferObject::deleteGLObject+0x69 [c:\users\code\openscenegraph-openscenegraph-3.6.0\src\osg\bufferobject.cpp @ 253]
00000075`2b19bf61 : osg156_osgrd!osg::GLBufferObjectSet::flushDeletedGLBufferObjects+0x25e [c:\users\code\openscenegraph-openscenegraph-3.6.0\src\osg\bufferobject.cpp @ 554]
0000018c`3829dc50 : osg156_osgrd!osg::GLBufferObjectManager::flushDeletedGLObjects+0x7e [c:\users\code\openscenegraph-openscenegraph-3.6.0\src\osg\bufferobject.cpp @ 984]
*** WARNING: Unable to verify checksum for osg156-osgUtilrd.dll
0000018c`2e070d90 : osg156_osgrd!osg::ContextData::flushDeletedGLObjects+0x65 [c:\users\code\openscenegraph-openscenegraph-3.6.0\src\osg\contextdata.cpp @ 88]
*** WARNING: Unable to verify checksum for osg156-osgViewerrd.dll
0000018c`37fcbb60 : osg156_osgUtilrd!osgUtil::SceneView::draw+0xdb [c:\users\code\openscenegraph-openscenegraph-3.6.0\src\osgutil\sceneview.cpp @ 987]
0000018d`01da2350 : osg156_osgViewerrd!osgViewer::Renderer::cull_draw+0x309 [c:\users\code\openscenegraph-openscenegraph-3.6.0\src\osgviewer\renderer.cpp @ 887]
00000000`00000000 : osg156_osgrd!osg::GraphicsContext::runOperations+0x99 [c:\users\code\openscenegraph-openscenegraph-3.6.0\src\osg\graphicscontext.cpp @ 696]
00000000`000003f9 : osg156_osgViewerrd!osgViewer::ViewerBase::renderingTraversals+0xc2d [c:\users\code\openscenegraph-openscenegraph-3.6.0\src\osgviewer\viewerbase.cpp @ 8
00000000`000003f9 :
osg156_osgViewerrd!osgViewer::ViewerBase::frame

attached windbg callstack.


any suggestion? fully appreciate!!!
...

Thank you!

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


Joined: 18 Mar 2009
Posts: 12269

PostPosted: Thu Jul 26, 2018 1:37 pm    Post subject:
[Crash issue] How to add&remove drawable (geometry) property.
Reply with quote

Hi Jinh,

First thing I would try is to run your application single threaded.
If this fixes the crash then it would indicate a threading issue with
how you are going about adding/remove elements of the scene graph.

You don't describe any of details of what threads are doing what so I
can't speculate any further as to what you might be doing wrong. As a
general guide, the OSG is designed for the main scene graph to be
updated only in the update and event phases/traversals where the scene
graph itself is being traversed single threaded.

Robert.
On Thu, 26 Jul 2018 at 14:14, Jinh Tang <> wrote:
Quote:

Hi,
I am doing them real-time rendering application development with Qt + OSG.
I created several threads to create new Geometry and in GUI - main threads, try to remove the old one and add new ones.

1, already set node and geometry to user dynamic.
geometry->setDataVariance(osg::Object::DYNAMIC)
geode_->setDataVariance(osg::Object::DYNAMIC);
2, already used osg smart point everywhere.
3, geometry is created in other threads. and post to a global queue.
4, in Main thread. PaintGL event will add&remove geometry in "autoAddRemove" function.
void OSGMeshRender::paintGL() {
autoAddRemove();
viewer_->frame();
}
5, the setup work for qt+osg is almost same like this blog, nothing speical.
vicrucann.github.io/tutorials/cmake-qt-osg-1/


I got below crash sometimes when I add&remove drawable.

0000082`873ba218 : nvoglv64+0x927b51
00000075`2b19bf61 : osg156_osgrd!osg::GLBufferObject::deleteGLObject+0x69 [c:\users\code\openscenegraph-openscenegraph-3.6.0\src\osg\bufferobject.cpp @ 253]
00000075`2b19bf61 : osg156_osgrd!osg::GLBufferObjectSet::flushDeletedGLBufferObjects+0x25e [c:\users\code\openscenegraph-openscenegraph-3.6.0\src\osg\bufferobject.cpp @ 554]
0000018c`3829dc50 : osg156_osgrd!osg::GLBufferObjectManager::flushDeletedGLObjects+0x7e [c:\users\code\openscenegraph-openscenegraph-3.6.0\src\osg\bufferobject.cpp @ 984]
*** WARNING: Unable to verify checksum for osg156-osgUtilrd.dll
0000018c`2e070d90 : osg156_osgrd!osg::ContextData::flushDeletedGLObjects+0x65 [c:\users\code\openscenegraph-openscenegraph-3.6.0\src\osg\contextdata.cpp @ 88]
*** WARNING: Unable to verify checksum for osg156-osgViewerrd.dll
0000018c`37fcbb60 : osg156_osgUtilrd!osgUtil::SceneView::draw+0xdb [c:\users\code\openscenegraph-openscenegraph-3.6.0\src\osgutil\sceneview.cpp @ 987]
0000018d`01da2350 : osg156_osgViewerrd!osgViewer::Renderer::cull_draw+0x309 [c:\users\code\openscenegraph-openscenegraph-3.6.0\src\osgviewer\renderer.cpp @ 887]
00000000`00000000 : osg156_osgrd!osg::GraphicsContext::runOperations+0x99 [c:\users\code\openscenegraph-openscenegraph-3.6.0\src\osg\graphicscontext.cpp @ 696]
00000000`000003f9 : osg156_osgViewerrd!osgViewer::ViewerBase::renderingTraversals+0xc2d [c:\users\code\openscenegraph-openscenegraph-3.6.0\src\osgviewer\viewerbase.cpp @ 8
00000000`000003f9 :
osg156_osgViewerrd!osgViewer::ViewerBase::frame

attached windbg callstack.


any suggestion? fully appreciate!!!
...

Thank you!

Cheers,

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








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


Joined: 26 Jul 2018
Posts: 6

PostPosted: Thu Jul 26, 2018 1:55 pm    Post subject:
Re: [Crash issue] How to add&remove drawable (geometry) property.
Reply with quote

Hi Robert,
thanks a lot! I tried single thread, but it can meet project requirement, as we may have 500+ meshes need to update. each mesh has 12000+ points. the main GUI thread will be blocked for 10+ seconds....
besides, I already set the viewer to use SingleThreaded. paste my code of initialization below:
Code:

 graphics_window_ = (new osgViewer::GraphicsWindowEmbedded(x, y, width, height) );
    viewer_ = new osgViewer::Viewer;
    scale_ = QApplication::desktop()->devicePixelRatio();
    root_ = new osg::Group;

    mouse_trans_ = new osg::PositionAttitudeTransform;
    root_->addChild(mouse_trans_);

    // init camera
    camera_ = new osg::Camera();
    //camera_ = viewer_->getCamera();
    camera_->setClearMask(GL_DEPTH_BUFFER_BIT);
    camera_->setClearMask(GL_COLOR_BUFFER_BIT);
    camera_->setViewport(x, y, width, height);
    camera_->setClearColor( osg::Vec4( 0.91f, 0.91f, 0.91f, 1.f ) );
    float aspectRatio = static_cast<float>(width) / static_cast<float>(height);
    camera_->setProjectionMatrixAsOrtho(-DEFAULT_ORTHO_RANGE * aspectRatio, DEFAULT_ORTHO_RANGE * aspectRatio, -DEFAULT_ORTHO_RANGE, DEFAULT_ORTHO_RANGE, -500.0, 500.0);
    camera_->setGraphicsContext( graphics_window_ );

    viewer_->setCamera(camera_);

    camera_->addChild(root_);
    viewer_->setSceneData(root_);

    camera_manipulator_ = new MeshCameraManipulator(camera_, osg::Vec3(0, 0, 100), osg::Vec3(0, 0, 0), osg::Vec3(0, 1, 0), mouse_trans_);
    camera_manipulator_->Setup(this);
    camera_manipulator_->SetWindowSize(width, height);
    viewer_->setCameraManipulator(camera_manipulator_);
    viewer_->setThreadingModel(osgViewer::Viewer::SingleThreaded);

    viewer_->realize();
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 Force OSG for GLES 2.0 to reenable ve... plamen_t General 4 Tue Jun 11, 2019 11:57 am View latest post
No new posts remove mipmap data from osg::Image Trajce Nikolov NICK General 0 Tue May 28, 2019 2:40 pm View latest post
No new posts Add/remove dynamically osg::View to o... innochenti General 0 Sat May 25, 2019 2:17 pm View latest post
No new posts Memory not being released, causing crash Juanelm General 1 Thu May 16, 2019 10:15 pm View latest post
No new posts Layered rendering with a geometry shader AnyOldName3 General 8 Tue May 14, 2019 11:25 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