[PD] passing a mat4 to a shader

Matteo Sisti Sette matteosistisette at gmail.com
Tue Mar 1 18:37:16 CET 2011


I see I can pass a 3- or 4- dimension vector to a glsl shader by 
delcaring a uniform variable of type vec3 or vec4 and sending 
[glsl_program] the vector as a list, for example, declaring in the shader:
   uniform vec4 mycolor;
and sending [glsl_program] the message "mycolor 1 0 1 1".

I tried the same with matrices (i.e. declaring uniform mat4 mymatrix and 
sending the message "mymatrix 1 1 1 1 ......") but it doesn't seem to 
work. I thought it would be a matter of finding out in which order to 
write the coefficients of the matrix, but whatever I send everything 
acts as if the matrix was always all-zero.

Is it supposed to work? If so what may I be missing?

I don't get any error message, neither when I link the program nor when 
I send the message with the matrix. It just acts like the matrix is 
always null.


More information about the Pd-list mailing list