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. Embedding OpenGL in QuickItem in Qt5 Scenegraph
Forum Updated to NodeBB v4.3 + New Features

Embedding OpenGL in QuickItem in Qt5 Scenegraph

Scheduled Pinned Locked Moved Game Development
6 Posts 4 Posters 8.6k 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.
  • D Offline
    D Offline
    DevinHughes
    wrote on last edited by
    #1

    Hi everyone,

    I'm not sure if this is the right place to post, but I couldn't find a Qt5 specific place, and there seems to be the most opengl chatter here. I have been messing with qt5 from git lately, and I want to make a custom QuickItem and corresponding node to embed an externally rendered texture into the scenegraph. I found the qmlogre example at qtlabs and it seems to fit the bill perfectly except he uses a private header file to reference QSGPlainTexture. Is there a public interface equivalent of QSGPlainTexture, or do I have to subclass QSGTexture and create it in my project? From what I can tell, the only public way to get my hands on a QSGTexture is from the QQuickWindow::createTextureFrom*** functions. Is there something I'm missing?

    Thanks,
    Devin

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DevinHughes
      wrote on last edited by
      #2

      I sat down tonight to take a second look at this and the answer is obvious. All I had to do was change from a custom node to a SimpleTextureNode and generate the GL texture in the quick item, which has a window reference. Now its all working, hooray!

      1 Reply Last reply
      0
      • O Offline
        O Offline
        ottobert
        wrote on last edited by
        #3

        can we use this approach to have a custom rendering in QtQuick 2.0 ?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          steno
          wrote on last edited by
          #4

          You can do custom rendering in this manner with openGL.

          "Check out this example":http://qt-project.org/doc/qt-5.1/qtquick/scenegraph-textureinthread.html

          1 Reply Last reply
          0
          • O Offline
            O Offline
            ottobert
            wrote on last edited by
            #5

            yes but I think it won't be performance efficient, is it?

            1 Reply Last reply
            0
            • Q Offline
              Q Offline
              qttester5
              wrote on last edited by
              #6

              I have been looking far and wide to find out how, if it's possible, you can fill a particular area in a QML screen with an OpenGL context and do custom OpenGL only in that context. I've seen plenty of demos where the QML components like buttons, etc lay on top or below a screen-wide OpenGL context (as is typically required by games), but I'd like to be able to situate several distinct OpenGL contexts within QML and have the QML file define how large they are, where they are positioned, etc.

              Now, since Qt 5 is all OpenGL under the hood, it makes me wonder if using a Canvas element with custom drawing via javascript would technically result in the same performance as custom OpenGL? This would be a meaningful alternative but it's not clear to me how the javascript drawing is handled via runtime compared to custom OpenGL drawing.

              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