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. Depth ordering with QSG
Forum Updated to NodeBB v4.3 + New Features

Depth ordering with QSG

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
scengraphqsg
1 Posts 1 Posters 283 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.
  • M Offline
    M Offline
    MansenC
    wrote on last edited by
    #1

    I have an application that relies on QSG. I have created a QQuickItem and overwritten updatePaintNode. In that I create a root node and append child nodes depending on the state of my application. I cannot control the order in which these nodes are created (Well, except sorting but I'd like to not do that, especially since node updates can happen frequently and I do not want to sort the entire list of children every so often), so I have to resort to depth ordering.

    My implementation uses the QSGGeometryNode as a base for every child node. I have a custom shader implementation that I tried to adjust to respect depth ordering. For that I tried to modify the gl_Position output vector's Z coordinate based on a value between 0 and 1, however nothing changed. That has me puzzled because in theory (according to OpenGL) this controls the depth. I expect that this is the case for every other qsg-backed renderer. The relevant snippet of my vertex shader is:

    #version 440
    
    layout(location = 0) in vec4 qt_VertexPosition;
    
    layout(std140, binding = 0) uniform buf {
        mat4 qt_Matrix;
    } ubuf;
    
    out gl_PerVertex { vec4 gl_Position; };
    
    void main()
    {
        gl_Position = ubuf.qt_Matrix * qt_VertexPosition;
    }
    

    How can I enable the usage of a depth buffer, since apparently it isn't being used here?

    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