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. QML ShaderEffect and property type
QtWS25 Last Chance

QML ShaderEffect and property type

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 3 Posters 2.0k 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.
  • A Offline
    A Offline
    apap_
    wrote on last edited by
    #1

    Hi all,

    I would like to pass a matrix3x3 to my openGL script but I can't find the right type to use in QML.
    It works with a matrix4x4 in the following example :

    @
    ShaderEffect {
    ...

    property matrix4x4 uMatrix: Qt.matrix4x4(1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1)
    
    ...
    

    }
    @

    Unfortunately the QML type "matrix3x3" does not exist. I tried many other types without success.
    Does anyone have a solution please ?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      amund_l
      wrote on last edited by
      #2

      Could you just use the matrix4x4, and then just fill the 4th column with '1'?
      The shaders are always using 4x4 and 4x1, and I guess that you are using the matrix in your shader. Post your full code, maybe I can help some more.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        apap_
        wrote on last edited by
        #3

        amund_l Thanks for reply.
        In my shader I use a matrix3x3 so I would like to set it directly from QML.
        Another solution would be to convert a matrix4x4 to matrix3x3 at the beginning of my shader. Is it possible ?
        Something like :
        @
        mat3 matrix3x3 = matrix4x4 * ???;"
        @

        1 Reply Last reply
        0
        • C Offline
          C Offline
          chrisadams
          wrote on last edited by
          #4

          The property types which are provided by QtQuick are listed at http://doc-snapshot.qt-project.org/qt5-stable/qtquick/qtquick-qmltypereference.html#basic-types however not all of them have conversions to uniforms/varyings in ShaderEffect. Matrix3x3 doesn't exist at all. vector2d, vector3d, vector4d, quaternion and matrix4x4 should all have conversions.

          Cheers,
          Chris.

          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