diff --git a/src/Shaders/VertexColorShader.cpp b/src/Shaders/VertexColorShader.cpp index 82e25231f..748036744 100644 --- a/src/Shaders/VertexColorShader.cpp +++ b/src/Shaders/VertexColorShader.cpp @@ -75,6 +75,11 @@ template VertexColorShader::VertexColorShade { transformationProjectionMatrixUniform = uniformLocation("transformationProjectionMatrix"); } + + /* Set defaults in OpenGL ES (for desktop they are set in shader code itself) */ + #ifdef MAGNUM_TARGET_GLES + setTransformationProjectionMatrix(typename DimensionTraits::MatrixType()); + #endif } template class VertexColorShader<2>; diff --git a/src/Shaders/VertexColorShader.h b/src/Shaders/VertexColorShader.h index 87c6a5c88..a68697f90 100644 --- a/src/Shaders/VertexColorShader.h +++ b/src/Shaders/VertexColorShader.h @@ -57,6 +57,8 @@ template class MAGNUM_SHADERS_EXPORT VertexColorShader: /** * @brief Set transformation and projection matrix * @return Pointer to self (for method chaining) + * + * Default is identity matrix. */ inline VertexColorShader* setTransformationProjectionMatrix(const typename DimensionTraits::MatrixType& matrix) { setUniform(transformationProjectionMatrixUniform, matrix); diff --git a/src/Shaders/VertexColorShader2D.vert b/src/Shaders/VertexColorShader2D.vert index f7d2c879e..627fe2a64 100644 --- a/src/Shaders/VertexColorShader2D.vert +++ b/src/Shaders/VertexColorShader2D.vert @@ -27,8 +27,12 @@ #define out varying #endif +#ifndef GL_ES #ifdef EXPLICIT_UNIFORM_LOCATION -layout(location = 0) uniform mat3 transformationProjectionMatrix; +layout(location = 0) uniform mat3 transformationProjectionMatrix = mat3(1.0); +#else +uniform mat3 transformationProjectionMatrix = mat3(1.0); +#endif #else uniform highp mat3 transformationProjectionMatrix; #endif diff --git a/src/Shaders/VertexColorShader3D.vert b/src/Shaders/VertexColorShader3D.vert index 9cf727389..cbc07d517 100644 --- a/src/Shaders/VertexColorShader3D.vert +++ b/src/Shaders/VertexColorShader3D.vert @@ -27,8 +27,12 @@ #define out varying #endif +#ifndef GL_ES #ifdef EXPLICIT_UNIFORM_LOCATION -layout(location = 0) uniform mat4 transformationProjectionMatrix; +layout(location = 0) uniform mat4 transformationProjectionMatrix = mat4(1.0); +#else +uniform mat4 transformationProjectionMatrix = mat4(1.0); +#endif #else uniform highp mat4 transformationProjectionMatrix; #endif