Im trying to move a transformation matrix onto the gpu, and I managed to find this code to help me on the way:
vertex.shader:
#version 410 core
layout ( location = 0 ) in vec3 vertex_position ;
mat4 rotationMatrix(vec3 axis, float angle)
{
axis = normalize(axis);
float s = sin(angle);
float c = cos(angle);
float oc = 1.0 - c;
return mat4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
0.0, 0.0, 0.0, 1.0);
}
void main()
{
gl_Position=rotationMatrix(vertex_position,45.0);
}
However, this gives errorc1035: assignment of incompatible types. Shouldnt this work? What am I missing