Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Interacting QML with external C++ OpenGL library
QtWS25 Last Chance

Interacting QML with external C++ OpenGL library

Scheduled Pinned Locked Moved 3rd Party Software
3 Posts 2 Posters 2.1k Views
  • 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.
  • I Offline
    I Offline
    inDigiNeous
    wrote on last edited by
    #1

    Hello,

    I am in the process of building a desktop OpenGL 3.3 app that would use QT5 QML for the UI parts and an external C++ standalone application (Core Renderer) for rendering the OpenGL scene.

    The separation would be thus:

    QT QML User Interface <----> Core Renderer

    I want to keep the Core Renderer separate, as it would be used in other projects also.
    The QML UI would control the Core Renderer through a public API exposed in the Core Renderer header files. For example modify objects, set object properties and so on that are rendered.

    What would be a good approach to integrate this Core Renderer into a QT5 Project ?
    If possible, I don't want to make the Core Renderer part dependent of the QT libraries.

    I have been looking into this, and currently the viable solution would look like this:

    • Specify the public API in the Core Renderer Header files
    • Include the Core Renderer in the QT5 UI application as a static library
    • Build a QML -> Core Renderer Bridge in the QT5 project, so that QML can call some sort of C++ wrapper that then calls the actual Core Renderer external methods, so we don't have any dependencies to QT in the Core Renderer part.

    Is this possible ? Any examples doing this already ?

    Idea would be to create the OpenGL Context in QT and then pass that created to the Core Renderer that would then handle the rendering from there. Is this possible ?

    Thank you for any help!

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      I'm not that intimate with internals of the QML engine (this is rather a question for Gunnar or Alan, you can catch them on IRC or the Interest mailing list), but I think the easiest way would be this:

      make your Core Renderer do it's job, then put out a texture that you - on the Qt and QML side - will intercept and put onto a customized QQuickItem, which will in turn paint it. This means you have a completely separate Core Renderer, as you want. And for Qt, you only add one QQuickItem, which you can use in whatever way you want, and interact with it the same way you can interact with any other item.

      (Z(:^

      1 Reply Last reply
      0
      • I Offline
        I Offline
        inDigiNeous
        wrote on last edited by
        #3

        Thank you for the answer sierdzio :) I will look at that method and see if it works. Sounds like it should be relatively easy to implement.

        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