Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. Transparent widget QT and Ogre
Forum Updated to NodeBB v4.3 + New Features

Transparent widget QT and Ogre

Scheduled Pinned Locked Moved Game Development
4 Posts 2 Posters 4.4k 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.
  • N Offline
    N Offline
    nyotis
    wrote on last edited by
    #1

    we ’ve been looking into using transparent widgets as overlays for ogre. Although Qwidgets are transparent by default, overlaying them over an Ogre widget is different and a black screen arises. On the ogre forum (http://www.ogre3d.org/forums/viewtopic.php?f=2&t=42733) I found the following:

    "Ok, to get my ideas straight I'm going to summarise the various approaches I have found to combining Ogre and Qt:

    1. Create a window (not necessarily a QGLWidget) using Qt and pass its window handle to Ogre using the 'externalWindowHandle' flag. Ogre then creates a context and is fully responsible for it. This is basically what I did for the first demo I made. It has the advantage that it should support both OpenGL and Direct3D, and also should work accross all platforms. The big drawback is that Qt widgets can only be overlaid (not integrated) so you don't get the nice transparency.

    2. An approach similar to (1) but with the difference that the frame buffer is explicitly read back from Ogre and used as a widget background. This would again work accross all render systems and platforms, and now Qt can perform proper compositing from transparency. However, it is potenially slow doe to the need to read back every frame and copy it to Qt. But this could make a good 'fallback' approach. I haven't tried implementing it yet.

    3. This is the 'proper' approach which we are really considering in this thread. It involves both Ogre and Qt owning OpenGL contexts and both rendering into the same widget. This widget is set as the background of a QGraphicsView/QGraphicsScene and other widgets can be overliad with proper transpaency effects. It only works with OpenGL and is (theorectically) cross platform. There are two variations:
      a. Allow Ogre to create it's own OpenGL context (passing the flag 'externalGLControl') and then retieve the context once createRenderWindow() has finished. Under windows there are the wglGetCurrentDC() and wglGetCurrentContext() for this - other platforms should have something similar.
      b. Have Qt create a context on Ogre's behalf and pass that to Ogre using the 'externalGLContext' flag. In this case Ogre basically does nothing except render into the context it it provided with - all the control is with Qt. I haven't quite got this to work yet as I was having crashes in both Qt and Ogre."

    Approach 1 is the one we followed for a project and as said above we’ve encountered the same problem with transparency. Approach 3 is possible, but we would be limiting ourselves to openGL. The code for that is available one page 3 of the forum-link.

    We’ve also found a demo video but I can’t find how it was implemented, but it looks really cool: http://youtu.be/b_3xfFuwGOQ

    Any hints, much appreciated

    1 Reply Last reply
    0
    • N Offline
      N Offline
      nyotis
      wrote on last edited by
      #2

      anyone? http://stackoverflow.com/questions/13339963/transparent-qt-widget-and-ogre

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        zester
        wrote on last edited by
        #3

        Here is the code for that video. (Needs Qt5)
        http://qt.gitorious.org/qt-labs/qmlogre

        There is also Cutexture (Needs Qt4)
        https://github.com/advancingu/Cutexture
        http://i56.tinypic.com/b6xb83.jpg

        Here is a Qt4 Ogre Widget example. (Needs Qt4)
        http://zester.googlecode.com/files/QtCreatorOgre2.zip

        1 Reply Last reply
        0
        • N Offline
          N Offline
          nyotis
          wrote on last edited by
          #4

          thanks @zester, I will have a look

          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