Frzn Flms Frzn Flms - 1 year ago 180
C++ Question

glm::value_ptr has too many arguments

I'm new to OpenGL and GLM. I've been following online tutorials in hope of finding one that works. One tutorial tells me to use this snippet:

//Define the screen width and height, and get the ratio
const float S_WIDTH = 800;
const float S_HEIGHT = 600;
const float S_RATIO = S_WIDTH / S_HEIGHT;

//In my shader "shdprog" get the uniform variable "ortho"'s location
GLuint orthoadr = glGetUniformLocation(shdprog, "ortho");

//Create a 4x4 matrix using glm
glm::mat4 ortho = glm::ortho(-S_RATIO, S_RATIO, -1.f, 1.f, -1.f, 1.f);

//Set the custom GLSL "ortho" uniform to the value of the glm::mat4 ortho
glUniform4fv(orthoadr, 1, GL_FALSE, glm::value_ptr(ortho)/*too many arguments in function call*/);

For whatever reason, Visual Studio tells me that
has too many arguments("too many arguments in function call"). Even removing all the arguments causes nothing to change.

Is my tutorial in the wrong? Or did I mistype something?

Answer Source

glUniform4fv takes three parameters. The function you're clearly looking for is glUniformMatrix4fv, which takes four.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download