qt 3d Qml透明Scene2D纹理

时间:2018-11-15 19:25:44

标签: qt opengl qml qt3d

如何在没有默认灰色背景的情况下渲染网格纹理?我的意思是,使用Scene2D组件生成具有alpha的纹理。现在看来,在我的红色矩形下面是PhonMaterial。

Entity {
id: root

components: [cubeTransform, cubeMaterial, cubeMesh]
PlaneMesh {
    id: cubeMesh
    width: 10
    height: 10
}
Transform {
    id: cubeTransform
    translation: Qt.vector3d(0, 4, 0)
    scale3D: Qt.vector3d(1, 1, 1)
}
TextureMaterial   {
    id: cubeMaterial
    texture: textureId
}
Scene2D {
    id: qmlTexture
    output: RenderTargetOutput {
        attachmentPoint: RenderTargetOutput.Color0
        texture: Texture2D {
            id: textureId

            width: 100
            height: 1024
            format: Texture.RGBA8_UNorm
            generateMipMaps: true
            magnificationFilter: Texture.Linear
            minificationFilter: Texture.LinearMipMapLinear
            wrapMode {
                x: WrapMode.ClampToEdge
                y: WrapMode.ClampToEdge
            }
        }
    }
    Rectangle {
        x: 50
        width: 50
        height: textureId.height
        color: "red"
    }
}
 }

现在,网格的一半是红色的(应该是红色的),但是第二个网格是白色的,而不是透明的。

enter image description here

0 个答案:

没有答案
相关问题