I read several (basic) shader guides. While they covered how to set variables in your shader. But it was only about ints, float or vector. I can not find anything about how to set mat4 variable. My shader expects the following:
uniform vec3 CameraPos;
uniform mat4 ModelWorld4x4;
So, the position of the camera and the world matrix of the model. I think I have CameraPos correctly, but how can I set the ModelWorld4x4 variable ??
This is how I installed vector3
campos = glGetUniformLocation(shader.id(), "CameraPos");
glUniform3f(campos, 0.0f, 0.0f, 3.0f);
This (one of the methods), as I tried to install mat4
glGetFloatv(GL_MODELVIEW_MATRIX, modelworld);
modelw = glGetUniformLocation(shader.id(), "ModelWorld4x4");
glUniformMatrix4fv(g_modelworld4x4, modelworld); // Not working
I use the Assimp library to load the model, so the world matrix is currently stored in the aiMatrix4x4 structure.
aiMatrix4x4 m = nd->mTransformation;
g_modelworld4x4 = m;
source
share