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. Debugging OpenGL in a QQuickItem custom drawing environment
QtWS25 Last Chance

Debugging OpenGL in a QQuickItem custom drawing environment

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 3 Posters 1.6k 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.
  • C Offline
    C Offline
    csubagio
    wrote on last edited by
    #1

    Hey there. I have a custom QQuickItem that hooks up a custom renderer to the afterRendering signal to do some fancy OpenGL work. (Which I'm having a ball of a time doing by the way; so many useful little Qt classes, it's great in here!)

    The problem I'm stumped on though, is that I'm filling a relatively weird little QOpenGLTexture::R16_SNorm texture with some custom data, and while it's working perfectly on a Windows 7 machine, I'm getting absolutely nothing on a Macbook. No errors or warnings, just a black texture when I go to look it up.

    I'm looking to get more information about what's happening, so I'm trying to instantiate a QOpenGLDebugLogger. Unfortunately, as I don't have access to the code that creates the OpenGL context, I can't set the debug flag, and the logger's initialize function fails. Does anyone know, for a QQmlApplicationEngine based application, where I might set that flag?

    Thanks!

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      ZapB
      wrote on last edited by
      #2

      Is it using a compatible OpenGL context? On OS X there is no compatibility profile and you can't share between a core profile for your custom renderer and Qt Quick 2's default context which is OpenGL 2.1. You can request a newer OpenGL version to be used by Qt QUick 2 by calling setFormat() in the ctor of your QQuickView subclass. In there you can for example request an OpenGL 3.2 Core (or 4.1 Core if you hw supports it) context. You may have more luck with that if you're using a renderer that uses the newer core profile contexts.

      Failing that, apitrace may give you some hints.

      Nokia Certified Qt Specialist
      Interested in hearing about Qt related work

      1 Reply Last reply
      0
      • C Offline
        C Offline
        csubagio
        wrote on last edited by
        #3

        Thanks for the answer ZapB, but I haven't subclassed a QQuickView. I started from a QQuickItem instead; did I go down the wrong path?

        1 Reply Last reply
        0
        • Z Offline
          Z Offline
          ZapB
          wrote on last edited by
          #4

          Not necessarily, that's a valid approach too but the same problem may occur. By default QQuickView uses an OpenGL 2.1 context.

          Try subclassing QQuickView and calling setFormat() with something like this:

          @
          QuickView::QuickView()
          : QQuickView()
          {
          QSurfaceFormat f = format();
          f.setVersion(3, 2); // Or whatever you want
          f.setProfile(QSurfaceFormat::CoreProfile);
          setFormat(f);
          }
          @

          This will cause Qt Quick 2 to try to create the requested version of OpenGL context which may allow your custom renderer to share textures on OS X.

          Of course it may be some totally different problem, but let's rule this out first and I have run into this issue before.

          Nokia Certified Qt Specialist
          Interested in hearing about Qt related work

          1 Reply Last reply
          0
          • S Offline
            S Offline
            seyed
            wrote on last edited by seyed
            #5

            Hey @csubagio do you have any solution for debugging QQuickItem inherited class?

            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