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. Qt5 Scene Graph custom geometry and gradients
Forum Updated to NodeBB v4.3 + New Features

Qt5 Scene Graph custom geometry and gradients

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 1.1k 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.
  • Y Offline
    Y Offline
    yanner
    wrote on last edited by
    #1

    Hi,

    Is there any other way to apply gradients to custom geometries in scene graph than creating custom material and own shader programs? Is their some material similar to QSGFlatColorMaterial with a gradient property that can be set?

    Thanks!

    1 Reply Last reply
    0
    • U Offline
      U Offline
      unai_i
      wrote on last edited by
      #2

      Hi,
      As far as I know there isn't such class in Qt. However depending on the gradient you want to achieve it shouldn't be too hard to write your own material and shader program.

      1 Reply Last reply
      0
      • Y Offline
        Y Offline
        yanner
        wrote on last edited by
        #3

        Thanks unai_i! Do you have any example on how this could work? Maybe this kind of general stuff could be already implemented in the ready made materials in the future?

        1 Reply Last reply
        0
        • U Offline
          U Offline
          unai_i
          wrote on last edited by
          #4

          I don't really have an example as the code will highly depend on the kind of shape and gradient you are trying to achieve. The easiest way is to use QSGGeometry::ColoredPoint2D for your vertices data and to adjust their color and placement in such way that when color is interpolated between vertices in fragment shader you get your desired gradient. I don't know if this will be implemented in ready made materials in the future.

          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