Coder Social home page Coder Social logo

gui-osgviz's Introduction

Osgviz

Osgviz aims to provide an easily accessible visualization using OpenSceneGraph (http://www.openscenegraph.org/).

Compiling

Installation

The easiest way to build and install this package is to use Rock's build system. See this page on how to install Rock.

However, if you feel that it's too heavy for your needs, Rock aims at having most of its "library" packages (such as this one) to follow best practices. See this page for installation instructions outside of Rock.

Rock CMake Macros

This package uses a set of CMake helper shipped as the Rock CMake macros. Documentations is available on this page.

Structure

Osgviz separates window handling and contents to display.

The main library allows to create windows and different views.

The contents can be put together manually or using so called Modules. These Modules are meant to be re-usable code to provide additional functionality.

Usage

It can be used in a threaded way or the update() function has to be called by your application

In order to visualize, you need to create a scene graph which is compatible to OpenSceneGraph, nevertheless Osgviz provides a helper class (Object) which can make is easier to handle your scene or click events.

Modules can be used directly or you can used the singleton loader provided by Osgviz, which makes it possible for modules to share a single Instance of another module

For usage examples have a look into the Main.cpp and start the demo program (osgViz_bin)

Extension Modules

Modules are extensions to osgviz that are hold by the main class as singleton.

These modules do not need to have any dependency to osgviz itself.

To create a custom module, you just have to write a c++ class, that has a constructor similar to a main function:

MyModule(int argc = 0, char** argv = nullptr);

To instanciate it as a singleton module, you can use the static function osgviz::OsgViz::getModuleInstance(std::string moduleName, int argc = 0, char **argv = NULL). The name is the identifier of the singleton. This way, Modules may interact with each other without any dependency to the OsgViz library

gui-osgviz's People

Contributors

2maz avatar annaborn avatar chhtz avatar mmaurus avatar planthaber avatar saarnold avatar skasperski avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gui-osgviz's Issues

Issue on shutdown of osg viz

I get the following backtrace when using a Vizkit3d widget in a ruby script on shutdown.
Since the shutdown is aborted all deployments will stay alive as well.

Stack trace (most recent call last):
#31   Object "/home/sirius/.autoproj/gems/ruby/2.3.0/gems/qtbindings-4.8.6.4/ext/build/ruby/qtruby/src/libqtruby4shared.so.2.0.0", at 0x7fcdf1a977d3, in QtRuby::MethodCall::callMethod()
#30   Object "/home/sirius/.autoproj/gems/ruby/2.3.0/gems/qtbindings-4.8.6.4/ext/build/smoke/qtgui/libsmokeqtgui.so.3.0.0", at 0x7fcdf01c6845, in __smokeqtgui::xcall_QApplication(short, void*, Smoke::StackItem*)
#29   Object "/home/sirius/.autoproj/gems/ruby/2.3.0/gems/qtbindings-4.8.6.4/ext/build/smoke/qtgui/libsmokeqtgui.so.3.0.0", at 0x7fcdf01cf3a0, in __smokeqtgui::x_QApplication::x_88(Smoke::StackItem*)
#28   Object "/usr/lib/x86_64-linux-gnu/libQtCore.so.4.8.7", at 0x7fcdf35784b8, in QCoreApplication::exec()
#27   Object "/usr/lib/x86_64-linux-gnu/libQtCore.so.4.8.7", at 0x7fcdf35724f4, in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)
#26   Object "/usr/lib/x86_64-linux-gnu/libQtCore.so.4.8.7", at 0x7fcdf357218e, in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
#25   Object "/usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.7", at 0x7fcdf21a9615, in 
#24   Object "/usr/lib/x86_64-linux-gnu/libQtCore.so.4.8.7", at 0x7fcdf35a42ad, in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
#23   Object "/lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.2", at 0x7fcdf312249b, in g_main_context_iteration
#22   Object "/lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.2", at 0x7fcdf31223ef, in 
#21   Object "/lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.2", at 0x7fcdf3122196, in g_main_context_dispatch
#20   Object "/usr/lib/x86_64-linux-gnu/libQtCore.so.4.8.7", at 0x7fcdf35a38f0, in 
#19   Object "/usr/lib/x86_64-linux-gnu/libQtCore.so.4.8.7", at 0x7fcdf35a677f, in 
#18   Object "/usr/lib/x86_64-linux-gnu/libQtCore.so.4.8.7", at 0x7fcdf357390c, in QCoreApplication::notifyInternal(QObject*, QEvent*)
#17   Object "/home/sirius/.autoproj/gems/ruby/2.3.0/gems/qtbindings-4.8.6.4/ext/build/smoke/qtgui/libsmokeqtgui.so.3.0.0", at 0x7fcdf01d0402, in __smokeqtgui::x_QApplication::notify(QObject*, QEvent*)
#16   Object "/usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.7", at 0x7fcdf2102f15, in QApplication::notify(QObject*, QEvent*)
#15   Object "/usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.7", at 0x7fcdf20fbfdb, in QApplicationPrivate::notify_helper(QObject*, QEvent*)
#14   Object "/usr/lib/x86_64-linux-gnu/libQtCore.so.4.8.7", at 0x7fcdf358dc82, in QObject::event(QEvent*)
#13   Object "/usr/lib/x86_64-linux-gnu/libQtCore.so.4.8.7", at 0x7fcdf358800f, in QMetaObject::activate(QObject*, QMetaObject const*, int, void**)
#12   Source "/home/sirius/entern/gui/vizkit3d/build/src/moc_Vizkit3DWidget.cxx", line 393, in qt_static_metacall [0x7fcd61617d6a]
        390:         case 3: _t->frameMoved((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QVector3D(*)>(_a[2])),(*reinterpret_cast< const QQuaternion(*)>(_a[3]))); break;
        391:         case 4: _t->frameMoving((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QVector3D(*)>(_a[2])),(*reinterpret_cast< const QQuaternion(*)>(_a[3]))); break;
        392:         case 5: _t->frameSelected((*reinterpret_cast< const QString(*)>(_a[1]))); break;
      > 393:         case 6: _t->update(); break;
        394:         case 7: _t->addPlugin((*reinterpret_cast< QObject*(*)>(_a[1])),(*reinterpret_cast< QObject*(*)>(_a[2]))); break;
        395:         case 8: _t->addPlugin((*reinterpret_cast< QObject*(*)>(_a[1]))); break;
        396:         case 9: _t->removePlugin((*reinterpret_cast< QObject*(*)>(_a[1]))); break;
#11   Source "/home/sirius/entern/gui/osgviz/osgviz/src/OsgViz.cpp", line 97, in update [0x7fcd88028b4d]
         94:     }
         95: 
         96:     mutex->lock();
      >  97:     windowManager->frame();
         98:     mutex->unlock();
#10   Source "/home/sirius/entern/gui/osgviz/osgviz/src/windows/WindowManager.cpp", line 62, in frame [0x7fcd8802de05]
         59:         //windows become invalid but are not removed from the window list
         60:         //thus we have to check if they are valid
         61:         if(witr->valid())
      >  62:             witr->get()->frame();
         63:     }
         64:     windowsMutex.unlock();
         65: }
#9    Object "/usr/lib/x86_64-linux-gnu/libosgViewer.so.3.2.1", at 0x7fcd605f2456, in osgViewer::ViewerBase::renderingTraversals()
#8    Object "/usr/lib/x86_64-linux-gnu/libosg.so.3.2.1", at 0x7fcd6115f42b, in osg::GraphicsContext::swapBuffers()
#7    Object "/usr/lib/x86_64-linux-gnu/libosgQt.so.3.2.1", at 0x7fcd6013bde2, in osgQt::GraphicsWindowQt::swapBuffersImplementation()
#6    Object "/usr/lib/x86_64-linux-gnu/libQtOpenGL.so.4.8.7", at 0x7fcded188386, in QGLContext::swapBuffers() const
#5    Object "/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0", at 0x7fcdebca21d6, in 
#4    Object "/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0", at 0x7fcdebccc0a3, in 
#3    Object "/usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0", at 0x7fcdebf88720, in xcb_wait_for_reply
#2    Object "/usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0", at 0x7fcdebf88616, in 
#1    Object "/usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0", at 0x7fcdebf86c61, in 
#0    Source "../sysdeps/unix/syscall-template.S", line 84, in poll [0x7fcdfbe9b70d]

osgviz tries to swapBuffers on non-exposed windows, resulting in message on stderr

This happens when running rock-display_bin.

The actual message is

QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined

A possible fix is this changeset:

diff --git a/src/windows/WindowManager.cpp b/src/windows/WindowManager.cpp
index 4742629..e254149 100644
--- a/src/windows/WindowManager.cpp
+++ b/src/windows/WindowManager.cpp
@@ -64,7 +64,7 @@ namespace osgviz {
         {
             //windows become invalid but are not removed from the window list
             //thus we have to check if they are valid
-            if(witr->valid())
+            if(witr->valid() && witr->get()->isRealized())
                 witr->get()->frame();
         }
         windowsMutex.unlock();
-- 

This has issues according to @planthaber .

Segfault when closing rock-display with osgviz

When I start rock-display and visualize anything using osgviz (e.g., RigidBodyState visualization) everything works fine, until I close rock-display, after which I get a segfault with the following error output (I removed the majority of the memory map section). Essentially the same is true for any ruby script which uses 3D-visualization of any kind.

This is quite annoying especially if one wants to read the last (regular) output lines of a script ...

chtz@chertzberg-u:~/workspace/entern$ rock-display 
Bundles[INFO]: Active bundles: entern, rock
orocos.rb[WARN]: /taskManagement is a task context not generated by orogen, using default task model
[BUG] Segmentation fault
ruby 2.0.0p384 (2014-01-12) [x86_64-linux-gnu]

-- C level backtrace information -------------------------------------------
/usr/lib/x86_64-linux-gnu/libruby-2.0.so.2.0(+0x177bbb) [0x7f0c40f45bbb]
/usr/lib/x86_64-linux-gnu/libruby-2.0.so.2.0(+0x64afa) [0x7f0c40e32afa] vfscanf.c:1394
/usr/lib/x86_64-linux-gnu/libruby-2.0.so.2.0(rb_bug+0xb3) [0x7f0c40e33203] vfscanf.c:858
/usr/lib/x86_64-linux-gnu/libruby-2.0.so.2.0(+0x112196) [0x7f0c40ee0196] getnameinfo.c:153
/lib/x86_64-linux-gnu/libc.so.6(+0x36cb0) [0x7f0c40a3fcb0] ../sysdeps/posix/killpg.c:37
/usr/lib/libosgText.so.99(_ZNK7osgText4Text16releaseGLObjectsEPN3osg5StateE+0x19) [0x7f0becb64c29] strtod_l.c:351
/usr/lib/libosg.so.99(_ZNK3osg5Geode16releaseGLObjectsEPNS_5StateE+0x30) [0x7f0bed425e10]
/usr/lib/libosg.so.99(_ZNK3osg5Group16releaseGLObjectsEPNS_5StateE+0x30) [0x7f0bed44fa00]
/usr/lib/libosg.so.99(_ZNK3osg5Group16releaseGLObjectsEPNS_5StateE+0x30) [0x7f0bed44fa00]
/usr/lib/libosg.so.99(_ZNK3osg5Group16releaseGLObjectsEPNS_5StateE+0x30) [0x7f0bed44fa00]
/usr/lib/libosg.so.99(_ZNK3osg5Group16releaseGLObjectsEPNS_5StateE+0x30) [0x7f0bed44fa00]
/usr/lib/libosg.so.99(_ZNK3osg5Group16releaseGLObjectsEPNS_5StateE+0x30) [0x7f0bed44fa00]
/usr/lib/libosg.so.99(_ZNK3osg5Group16releaseGLObjectsEPNS_5StateE+0x30) [0x7f0bed44fa00]
/usr/lib/libosg.so.99(_ZNK3osg5Group16releaseGLObjectsEPNS_5StateE+0x30) [0x7f0bed44fa00]
/usr/lib/libosg.so.99(_ZN3osg15GraphicsContext12removeCameraEPNS_6CameraE+0x1ce) [0x7f0bed44778e]
/usr/lib/libosg.so.99(_ZN3osg6CameraD1Ev+0x3f) [0x7f0bed3de00f]
/usr/lib/libosg.so.99(_ZN3osg6CameraD0Ev+0x9) [0x7f0bed3de5c9]
/usr/lib/libosg.so.99(_ZN3osg4ViewD2Ev+0x3b7) [0x7f0bed524c27]
/home/chtz/workspace/entern/install/lib/libosgViz.so(_ZN6osgviz9SuperViewD1Ev+0x1a8) [0x7f0bec411588] ../iconv/loop.c:448
/home/chtz/workspace/entern/install/lib/libosgViz.so(_ZN6osgviz9SuperViewD0Ev+0x9) [0x7f0bec4115d9] ../iconv/loop.c:437
/usr/lib/libosgViewer.so.99(_ZNSt6vectorIN3osg7ref_ptrIN9osgViewer4ViewEEESaIS4_EED1Ev+0x50) [0x7f0bec8ac1b0] vfscanf.c:1700
/usr/lib/libosgViewer.so.99(_ZN9osgViewer15CompositeViewerD2Ev+0x1ea) [0x7f0bec8a7f8a] vfscanf.c:1854
/home/chtz/workspace/entern/install/lib/libosgViz.so(_ZN6osgviz6WindowD1Ev+0x1df) [0x7f0bec40e0ff] gconv_conf.c:569
/home/chtz/workspace/entern/install/lib/libosgViz.so(_ZN6osgviz6WindowD0Ev+0x9) [0x7f0bec40e149] gconv_conf.c:384
/home/chtz/workspace/entern/install/lib/libosgViz.so(_ZN6osgviz13WindowManagerD1Ev+0x53) [0x7f0bec410a93] ../iconv/loop.c:437
/home/chtz/workspace/entern/install/lib/libosgViz.so(_ZN6osgviz13WindowManagerD0Ev+0x9) [0x7f0bec410ad9] ../iconv/loop.c:476
/home/chtz/workspace/entern/install/lib/libvizkit3d.so(_ZNK3osg10Referenced5unrefEv+0x1f) [0x7f0bed8a1daf] ../stdlib/gmp.h:459
/home/chtz/workspace/entern/install/lib/libosgViz.so(_ZN6osgviz6OsgVizD1Ev+0x85) [0x7f0bec40bef5] gconv_open.c:238
/home/chtz/workspace/entern/install/lib/libosgViz.so(_ZN6osgviz6OsgVizD0Ev+0x9) [0x7f0bec40bf59] gconv_open.c:265
/home/chtz/workspace/entern/install/lib/libosgViz.so(_ZN3osg7ref_ptrIN6osgviz6OsgVizEED1Ev+0x36) [0x7f0bec40c146] gconv_open.c:330
/lib/x86_64-linux-gnu/libc.so.6(+0x3c1a9) [0x7f0c40a451a9] exit.c:82
/lib/x86_64-linux-gnu/libc.so.6(+0x3c1f5) [0x7f0c40a451f5] exit.c:104
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfc) [0x7f0c40a2af4c] libc-start.c:321
/usr/bin/ruby2.0() [0x400899]

-- Other runtime information -----------------------------------------------

* Process memory map:

00400000-00401000 r-xp 00000000 08:01 4735374                            /usr/bin/ruby2.0
00600000-00601000 r--p 00000000 08:01 4735374                            /usr/bin/ruby2.0
00601000-00602000 rw-p 00001000 08:01 4735374                            /usr/bin/ruby2.0
0069a000-083ea000 rw-p 00000000 00:00 0                                  [heap]

    2000+ Lines of Process memory map ...

7fff393fe000-7fff39400000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]


[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

libosgViz.so : undefined reference to 'non virtual thunk to osgga:: EventHandler:: event (OSG:: nodevisitor *, OSG:: drawable *')

Scanning dependencies of target osgViz_bin
[ 89%] Building CXX object src/CMakeFiles/osgViz_bin.dir/Main.cpp.o
[ 92%] Linking CXX executable osgViz_bin
libosgViz.so:对‘non-virtual thunk to osgGA::EventHandler::event(osg::NodeVisitor*, osg::Drawable*)’未定义的引用
libosgViz.so:对‘osg::NodeCallback::run(osg::Object*, osg::Object*)’未定义的引用
libosgViz.so:对‘osgGA::EventHandler::event(osg::NodeVisitor*, osg::Drawable*)’未定义的引用
libosgViz.so:对‘virtual thunk to osg::NodeCallback::run(osg::Object*, osg::Object*)’未定义的引用
libosgViz.so:对‘typeinfo for osgGA::EventHandler’未定义的引用
libosgViz.so:对‘osg::Callback::traverse(osg::Object*, osg::Object*)’未定义的引用
libosgViz.so:对‘osgGA::GUIEventHandler::handle(osgGA::Event*, osg::Object*, osg::NodeVisitor*)’未定义的引用
libosgViz.so:对‘osgViewer::View::addEventHandler(osgGA::EventHandler*)’未定义的引用
libosgViz.so:对‘non-virtual thunk to osgViewer::View::computeIntersections(osgGA::GUIEventAdapter const&, std::multiset<osgUtil::LineSegmentIntersector::Intersection, std::lessosgUtil::LineSegmentIntersector::Intersection, std::allocatorosgUtil::LineSegmentIntersector::Intersection >&, unsigned int)’未定义的引用
libosgViz.so:对‘osgGA::EventHandler::operator()(osg::Node*, osg::NodeVisitor*)’未定义的引用
libosgViz.so:对‘non-virtual thunk to osgViewer::View::computeIntersections(osgGA::GUIEventAdapter const&, std::vector<osg::Node*, std::allocatorosg::Node* > const&, std::multiset<osgUtil::LineSegmentIntersector::Intersection, std::lessosgUtil::LineSegmentIntersector::Intersection, std::allocatorosgUtil::LineSegmentIntersector::Intersection >&, unsigned int)’未定义的引用
libosgViz.so:对‘osgGA::EventHandler::handle(osgGA::Event*, osg::Object*, osg::NodeVisitor*)’未定义的引用
libPrimitivesFactory.so:对‘osg::Group::removeChild(osg::Node*)’未定义的引用
libosgViz.so:对‘vtable for osgGA::EventHandler’未定义的引用
libosgViz.so:对‘osg::Drawable::EventCallback::run(osg::Object*, osg::Object*)’未定义的引用
libosgViz.so:对‘virtual thunk to osg::Drawable::EventCallback::run(osg::Object*, osg::Object*)’未定义的引用
libosgViz.so:对‘VTT for osgGA::EventHandler’未定义的引用
libosgViz.so:对‘osgViewer::View::removeEventHandler(osgGA::EventHandler*)’未定义的引用
libPrimitivesFactory.so:对‘osg::Group::getNumChildren() const’未定义的引用
collect2: error: ld returned 1 exit status
src/CMakeFiles/osgViz_bin.dir/build.make:210: recipe for target 'src/osgViz_bin' failed
make[2]: *** [src/osgViz_bin] Error 1
CMakeFiles/Makefile2:202: recipe for target 'src/CMakeFiles/osgViz_bin.dir/all' failed
make[1]: *** [src/CMakeFiles/osgViz_bin.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.