Vec4 = mat4 + vec4

Hi,

It seams that the following code should work:
vec4 v1, v2;
mat4 m;

v2 = m + v1;

This seams strange to me, is anybody able to tell how is working this operator?

Thanks

The sum of a matrix and a vector does not make sense. Where did you see this code?

Perhaps it’s a typo and it should be:
v2 = m * v1;

It isn’t a typo problem. glValidate allow this when I did a mistake in a shader writing + instead of *
… It’s probably a component wise operator but what does it do? Or a bug…

thank

My version of GLSLvalidate (v1.9) bristles quite fervently when given that nonsense.

ERROR: 0:9: ‘+’ : wrong operand types no operation ‘+’ exists that takes a left-hand operand of type ‘4X4 matrix of float’ and a right operand of type ‘4-component vector of float’ (or there is no acceptable conversion)
ERROR: 0:9: ‘assign’ : cannot convert from ‘4X4 matrix of float’ to ‘4-component vector of float’
ERROR: 2 compilation errors. No code generated.
It goes on, but it gets pretty nasty. I tried to reason with it, but it’s having nothing of it.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.