What is the equivalent conversion of the glsl mat2 type in Renderscript and how to use it?
I came to the conclusion that it may be rs_matrix2x2, but I can't find any sample code about how to use it.
I 'm trying to convert the next GLSL snippet into RenderScript:
GLSL:
vec2 test(vec2 coord, float c, float s)
{
mat2 m = mat2(c, -s, s, c);
return m * coord;
}
Rendercript:
float2 test(float2 coord, float c, float s)
{
//???? -> mat2 m = mat2(c, -s, s, c);
return m * coord;
}
Just found the solution. In case is of any use to others, here is the conversion and usage based in the sample snipped in the question:
float2 test(float2 coord, float c, float s)
{
rs_matrix2x2 m = {c, -s, s, c};
return rsMatrixMultiply(&m, coord);
}