Search code examples
c++qtqt6qtguiqtopengl

How to set color mask in Qt 6 RHI


I am currently porting OpenGL code to QRhi (Qt 6.7). For glColorMask(red, green, blue, alpha) there seems to be a documented flag (https://doc.qt.io/qt-6/qrhigraphicspipeline.html#ColorMaskComponent-enum). But how can I set this flag?

Regards,


Solution

  • Setting the color mask is part of the QRhiGraphicsPipeline::TargetBlend:

    QList<QRhiGraphicsPipeline::TargetBlend> targetBlends(1);
    targetBlends[0].enable = true;
    targetBlends[0].colorWrite = QRhiGraphicsPipeline::ColorMask(0xF);
    pipeLine->setTargetBlends(targetBlends.begin(), targetBlends.end());