Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Rendering an OSG::Node in / as Qt Quick Item
Forum Updated to NodeBB v4.3 + New Features

Rendering an OSG::Node in / as Qt Quick Item

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 2.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    werispaul
    wrote on last edited by
    #1

    Hi,

    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.

    • http://doc.qt.io/qt-5/qtquick-scenegraph-openglunderqml-example.html

    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.

    • http://doc.qt.io/qt-5/qtquick-scenegraph-textureinsgnode-example.html

    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:

    • https://github.com/preet/scratch/tree/master/qt5/qquickfboviewport

    Tried the same as above, which worked until i set the viewer as embedded window.

    Thank you for any hints and tips!

    podsvirovP 1 Reply Last reply
    0
    • W werispaul

      Hi,

      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.

      • http://doc.qt.io/qt-5/qtquick-scenegraph-openglunderqml-example.html

      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.

      • http://doc.qt.io/qt-5/qtquick-scenegraph-textureinsgnode-example.html

      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:

      • https://github.com/preet/scratch/tree/master/qt5/qquickfboviewport

      Tried the same as above, which worked until i set the viewer as embedded window.

      Thank you for any hints and tips!

      podsvirovP Offline
      podsvirovP Offline
      podsvirov
      wrote on last edited by
      #2

      Hello @werispaul!

      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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved