Problem with Uniforms and matrices

Before i start i would like to point out that im really bad when it comes to programming and im trying to learn it.:whistle:

So i am trying to get a 3d application with a camera and with the help of uniforms. I want a setUniform to have both a location and a 4v4 matrix (glm::mat4).
But i googled around for glUniform to use and stumble across a problem. I tryied glUniform4ui but than it complains about (glm::mat4) and says that the type name is not allowed. Than i got help from a guy who said that i should use glUniformMatrix4fv and still got the same error. As i said in the beginning im really bad at programming and still trying to learn it so please dont be harsh on me if im missing some major point here. :smiley:

Thanks in advance!

void ShaderManager::setUniform(GLuint gMyUniformLocation,glm::mat4)
glUniformMatrix4fv(gMyUniformLocation, glm::mat4);

You’re confusing variables with types. glm::mat4 is a type, not a variable. You need a variable of that type, and to pass it to the function, which should look like e.g.

void ShaderManager::setUniform(GLuint gMyUniformLocation, glm::mat4 matrix)
	glUniformMatrix4fv(gMyUniformLocation, matrix);

Well did as you said but now its complaining on something else :S

Two arguments are missing, and glUniformMatrix4fv expects a pointer, not a glm::mat4. Read the documentation.

It should look like this :

glUniformMatrix4fv(gMyUniformLocation, 1, GL_FALSE, glm::value_ptr(matrix));