Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. why QSGTexture::WrapMode::Repeat not work?

why QSGTexture::WrapMode::Repeat not work?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 1 Posters 202 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.
  • R Offline
    R Offline
    robbey
    wrote on last edited by
    #1

    void shapeObject::setQSGColor(QSGGeometryNode& aNode, const QColor& aColor){
    QSGOpaqueTextureMaterial *material = new QSGOpaqueTextureMaterial();

    auto img = QImage(4, 1, QImage::Format_ARGB32);
    img.fill("transparent");
    {
        QPainter pnt(&img);
        pnt.fillRect(0, 0, 2, 1, aColor);
    }
    auto txt = m_window->window()->createTextureFromImage(img);
    txt->setHorizontalWrapMode(QSGTexture::WrapMode::Repeat); //not work!?
    material->setTexture(txt);
    aNode.setMaterial(material);
    aNode.setFlag(QSGNode::OwnsMaterial);
    aNode.markDirty(QSGNode::DirtyMaterial);
    

    }
    whatever which wrapmode I set for the texture, it always works as the QSGTexture::WrapMode::ClampToEdge for the coordinates being out of [0, 1].
    Is this a bug? My Qt version is Qt5.12.2? Or is there anything wrong for my codes?

    1 Reply Last reply
    0
    • R Offline
      R Offline
      robbey
      wrote on last edited by
      #2

      it has been solved. we should use the same named api of the material rather than texture...

      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