-2

I can't use my matrix in my OpenGL shader; this is giving me an error:

glUniform4f(matLocation, mat[0], mat[1], mat[2], mat[3]); // glm mat4

no suitable conversion function from "glm::tvec4<float, glm::highp>" to "GLfloat" exists

I don't entirely understand why it's giving me this error message, and as usual, Googling doesn't give me any good results. Why would it want me to convert matrices to floats?

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
Accumulator
  • 873
  • 1
  • 13
  • 34

1 Answers1

1

glUniform4f only updates a vec4 with four float values, so you need glUniformMatrix4fv which takes a pointer to an array of 16 float values glm can provide with glm::value_ptr.

mat[n] only yields the nth column, a vec4; thus the compilation error.

pleluron
  • 733
  • 4
  • 12