Congratulations to our 2022 Qt Champions!

The default vertexShader property of ShaderEffectItem

  • There "ShaderEffectItem": object which which allows to alter the output of given item with OpenGL shaders. This element have some properties, such as fragmentShader, vertexShader and etc

    The default vertex shader is following:
    @ uniform highp mat4 qt_ModelViewProjectionMatrix;
    attribute highp vec4 qt_Vertex;
    attribute highp vec2 qt_MultiTexCoord0;
    varying highp vec2 qt_TexCoord0;
    void main(void)
    qt_TexCoord0 = qt_MultiTexCoord0;
    gl_Position = qt_ModelViewProjectionMatrix * qt_Vertex;

    The default fragment shader is following:
    @varying highp vec2 qt_TexCoord0;
    uniform sampler2D source;
    void main(void)
    gl_FragColor = texture2D(source,;

    When I don't set a vertex shader property of ShaderEffectItem, for instance, QML use the default property? which i have written above ?

    P.S. Sorry for may bad English

  • Yes. These shaders are defaults. If you don't specify one of them(or both), QML automaticaly will use default ones.

Log in to reply