Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.7.2, 4.7.3, 4.8.x
-
None
-
41287c411cb4b1019d12a49ddf7a738174a42f25
Description
This is the vertex shader program example in the qt documentation:
program.addShaderFromSourceCode(QGLShader::Vertex,
"attribute highp vec4 vertex;\n"
"attribute mediump mat4 matrix;\n"
"void main(void)\n"
"
");
The matrix should be uniform -> "uniform mediump mat4 matrix;\n"
Then a uniform location has to be querieed:
old: "int matrixLocation = program.attributeLocation("matrix");"
new: "int matrixLocation = program.uniformLocation("matrix");"
Without these changes, the example doesn't work, because later in the code "matrix" is set as uniform value.
"program.setUniformValue(matrixLocation, pmvMatrix);"
Also you should consider renaming "matrix" to "ModelViewProjectionMatrix"