Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Are the variable names "mvp",“modelMatrix”,“modelNormalMatrix" reserved words?



  • when I run the example of advancedcustommaterial ,I can find the "mvp" word in water.vert es2 shaders file,but I cann't find this word in any other( .qml) files in this project .I wonder how the qml set the value of "mvp" .Is the variable names "mvp" a reserved word in qml? How can I get the Reference documents about this?(version,Qt 5.11.0 64bit ,Qt Creator 4.6.1 )


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    No they are not, if we take mvp, you can find the declaration as: uniform mat4 mvp.

    From the khronos documentation:

    A uniform is a global Shader variable declared with the "uniform" storage qualifier. These act as parameters that the user of a shader program can pass to that program. Their values are stored in a program object.
    
    Uniforms are so named because they do not change from one shader invocation to the next within a particular rendering call. This makes them unlike shader stage inputs and outputs, which are often different for each invocation of a shader stage.
    

    For more details, see the definition of a uniform in GLSL.


Log in to reply