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. Software rendering in QQuickItem/QSGGeometryNode
QtWS25 Last Chance

Software rendering in QQuickItem/QSGGeometryNode

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 595 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.
  • P Offline
    P Offline
    posix
    wrote on last edited by posix
    #1

    I'm trying to draw a colored square in my custom QML component (QQuickItem).

    QQuickItem::updatePaintNode similar code:

    QSGGeometryNode *rect = new QSGGeometryNode();
    QSGFlatColorMaterial *material = new QSGFlatColorMaterial();
    QSGGeometry *geometry = new QSGGeometry(QSGGeometry::defaultAttributes_Point2D(), 4);
    
    QSGGeometry::updateRectGeometry(geometry, boundingRect());
    material->setColor(QColor::red);
    
    rect->setMaterial(material);
    rect->setGeometry(geometry);
    

    Example full project: https://file.io/icMlsHCeK8tb

    I'm using software rendering like this:

    QQuickWindow::setGraphicsApi(QSGRendererInterface::Software);
    

    The problem is that the square is not drawn. If I turn on GPU rendering (OpenGL or Vulcan), then it works and I see a square. I am using Qt 6.6.0 from MaintenanceTool.

    How to fix it?

    P 1 Reply Last reply
    0
    • P posix

      I'm trying to draw a colored square in my custom QML component (QQuickItem).

      QQuickItem::updatePaintNode similar code:

      QSGGeometryNode *rect = new QSGGeometryNode();
      QSGFlatColorMaterial *material = new QSGFlatColorMaterial();
      QSGGeometry *geometry = new QSGGeometry(QSGGeometry::defaultAttributes_Point2D(), 4);
      
      QSGGeometry::updateRectGeometry(geometry, boundingRect());
      material->setColor(QColor::red);
      
      rect->setMaterial(material);
      rect->setGeometry(geometry);
      

      Example full project: https://file.io/icMlsHCeK8tb

      I'm using software rendering like this:

      QQuickWindow::setGraphicsApi(QSGRendererInterface::Software);
      

      The problem is that the square is not drawn. If I turn on GPU rendering (OpenGL or Vulcan), then it works and I see a square. I am using Qt 6.6.0 from MaintenanceTool.

      How to fix it?

      P Offline
      P Offline
      posix
      wrote on last edited by posix
      #2

      @posix said in Software rendering in QQuickItem/QSGGeometryNode:

      Example full project:

      https://easyupload.io/4l1e86

      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