Important: Please read the Qt Code of Conduct -

why QSGTexture::WrapMode::Repeat not work?

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

    auto img = QImage(4, 1, QImage::Format_ARGB32);
        QPainter pnt(&img);
        pnt.fillRect(0, 0, 2, 1, aColor);
    auto txt = m_window->window()->createTextureFromImage(img);
    txt->setHorizontalWrapMode(QSGTexture::WrapMode::Repeat); //not work!?

    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?

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

Log in to reply