PDA

View Full Version : A simple question baout mat4



Ehsan Kamrani
01-04-2007, 05:34 AM
Hi
mat4 is a 4*4 matrix. can I initialize this matrix with 12 values?As an example:
vec4 a(0,0,0,0);
vec4 b(1,1,1,1);
vec4 c(2,2,2,2);
mat4 d(a, b, c );

-Ehsan-

tomtrenki
01-04-2007, 07:45 AM
no.
the spec states that there must always be enough components to initialize a whole vector or matrix, so in your case you need 16 values.

Ehsan Kamrani
01-06-2007, 12:31 AM
I guess this law is not correct for vectors. Also we can use from one number to initialize the matrix. As an example the following command sets all the diagonal values to 1 and sets other values to 0:
mat3 matrix(1);
( But I think that if we use from more than one value to initialize matices, we should initialize all the values ).
-Ehsan-