Important: Please read the Qt Code of Conduct -

Qt3D 2.0 (+QML) simple shader doesn't appear to work

  • I have a basic scene using Qt3D 2.0. It has a cube and a Material like in the following code. And the fragment shader just sets fragColor = vec4(1.0, 0.0, 0.0, 1.0). But no matter how I rearrange things, I get the default brown-yellow color. I can confirm that the shaders themselves are being properly loaded.

    Full example project:

    Material {
        id: material
        effect: Effect {
            techniques: [
                Technique {
                    openGLFilter {
                        api: OpenGLFilter.Desktop
                        profile: OpenGLFilter.Core
                        majorVersion: 3; minorVersion: 1
                    renderPasses: [
                        RenderPass {
                            shaderProgram: ShaderProgram {
                                vertexShaderCode:   loadSource( "qrc:/shader.vert" )
                                fragmentShaderCode: loadSource( "qrc:/shader.frag" )

    I know I'm working at the bleeding edge. I'm not sure if this is a bug, or something that I'm not quite doing right.