PDA

View Full Version : vec4 = mat4 + vec4



Groovounet
08-05-2006, 06:21 PM
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

Overmind
08-06-2006, 12:31 PM
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;

Groovounet
08-06-2006, 02:04 PM
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

Brolingstanz
08-06-2006, 04:24 PM
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.