Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Rendering an OSG::Node in / as Qt Quick Item
werispaul last edited by
I'm looking for the correct way to render an OpenSceneGraph object (osg::node) in a Qt Quick Item in a QML window (preferable over other qml items, but not necessary). I found several solutions/ways which cover different ways to solve this issue, but since they seem to be partially outdated and there are plenty changes in the last minor Qt version regarding OpenGL, I'm not sure which should be the best way to go.
(I'm using OSG 3.2.1 and Qt 5.3)
To my knowledge there are mainly two ways to go:
- Share the GLContext with Qt, and render the object directly (e.g. in afterRendering)
- Render the osg::Node to a FBO which is displayed used as texture from Qt
I've tried to adapt both official examples but could not get them to render my osg::node correctly.
Added creation of a osgViewer to the paint function and set up the Viewer as embedded Window. Used osgCamera getGraphicsContext to reset and set the context. Used the viewer to render the frame (viewer-frame()) in the paint function.
Added creation of a osgViewer to the LogoRenderer::initialize function. Used osgCamera getGraphicsContext to reset and set the context. Used the viewer to render the frame (viewer-frame()) in the LogoRenderer::render function
In addition I've tried to adapt the following project to my needs:
Tried the same as above, which worked until i set the viewer as embedded window.
Thank you for any hints and tips!
podsvirov last edited by
I just now saw your post, but if the issue is still relevant, you can pay attention to my project osgQtQuick.
If you have any further questions, feel free to ask - I'll try to answer.