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. Integrating existing OpenGL renderer in Qt Quick 2

Integrating existing OpenGL renderer in Qt Quick 2

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 933 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.
  • H Offline
    H Offline
    Hornet
    wrote on last edited by
    #1

    Hello

    I'm currently working on integrating an existing OpenGL renderer into Qt Quick. I took inspiration from https://github.com/advancingu/QmlOgre/tree/master/lib (Ogre integration) and tried to achieve something similar, but not limited to ogre.

    My current status is the following: https://gist.github.com/krond/8191037
    Short summary of the code: I tried creating a custom Qml Component that creates a shared OpenGL context with the one from Qt Quick and bind to a framebuffer that writes to a texture before calling the actual renderer.

    Unfortunately, it doesn't fully work yet. I have the following insights:

    The renderer works standalone if used with glfw or with QWindow.

    • In the display()-method of the renderer, I suffixed every OpenGL call with a glGetError() and I always get 0 (no error).
    • I checked the instantiated QOpenGL* objects (from Qt) that provide a isValid()/isBound() method and they all return true.
    • If i set a different clear color with glClearColor() in the renderers initialize()-method, the background actually gets filled with the correct color and is also displayed in the Qt Quick GUI.
    • After the glFlush() i can do a QOpenGLFramebufferObject.toImage().save() and the image is also filled with the same color, so I guess the framebuffer to texture is working.

    I'm new to Qt Quick and I don't know the things going on behind the scenes, so I have these questions:

    • Why could other OpenGL calls besides glClear() not be working?
    • Do you guys have any guesses or ideas what the problem might be or where I had some wrong thoughts?

    I'm not sure if users try out code posted in forums, but if you are interested, I put together a minimal example that shows the problem: https://dl.dropboxusercontent.com/u/44536413/Test.zip (There are two Qt project and main files: one working, the other not).
    I'm using Qt 5.2 and MSVC2012 32bit for compilation.

    Thanks and a happy new year,
    Hornet

    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