I try to compile the following code in Open GL ES 2.0 (in RenderMonkey):
const mat2 ma[2] = mat2[2](
mat2( vec2(0.0, -1.0), vec2(1.0, 0.0) ),
mat2( vec2(0.0, -1.0), vec2(1.0, 0.0) )
);
But compiler says:
OpenGL ES Preview Window: Compiling vertex shader API(OpenGL ES) /Effect Group 1/Effect1/Pass 0/Vertex Program/ ... failure
COMPILE ERROR: API(OpenGL ES) /Effect Group 1/Effect1/Pass 0/Vertex Program/ (13): ERROR: 0:13: 'constructor' : if a matrix argument is given to a matrix constructor, it is an error to have any other arguments.
COMPILE ERROR: API(OpenGL ES) /Effect Group 1/Effect1/Pass 0/Vertex Program/ (10): ERROR: 0:10: '=' : cannot assign to 'const array of 2X2 matrix of float'
What I am doing wrong?
[EDIT]
In webgl/chrome, I get this:
It doesn't look good.
Possibly related: How to define constant array in GLSL (OpenGL ES 2.0)?
Desktop GL...
Your code works for me, however I get this without setting a version:
Can you provide a
#version
string in RenderMonkey?I doubt this is the case but a really old card or drivers may be a factor.
I don't think you need the second
2
either:const mat2 ma[2] = mat2[](...
is fine