c++ - glUniform3fv not working OpenGL -


i'm working on piece of code in opengl. i'm getting following error message while trying compile:

myglwidget.cpp: in member function ‘virtual void myglwidget::initializegl()’: myglwidget.cpp:30:38: error: cannot convert ‘glm::vec3 {aka glm::tvec3<float, (glm::precision)0u>}’ ‘const glfloat* {aka const float*}’ in argument passing myglwidget.cpp:31:39: error: cannot convert ‘glm::vec3 {aka glm::tvec3<float, (glm::precision)0u>}’ ‘const glfloat* {aka const float*}’ in argument passing 

i have declared these locations in myglwidget.h follows:

    gluint llumloc, focusloc; 

and have initialize them in myglwidget.cpp as:

  llumloc = glgetuniformlocation (program->programid(), "llumambient");   focusloc = glgetuniformlocation (program->programid(), "posfocus"); 

"llumambient" , "posfocus" uniforms in vertex shader:

uniform vec3 llumambient; uniform vec3 posfocus; 

i mentioned error message while trying call following code inside of myglwidget::initializegl

gluniform3fv(llumloc, 1, glm::vec3(0.2)); gluniform3fv(focusloc, 1, glm::vec3(1.0)); 

obviously, i've tried follow documentation @ www.opengl.org , glm.g-truc.net/0.9.2/api/a00001.html, can't see what's wrong code...

you need give pointer vector, not vector itself. example:

glm::vec3 v(1.0f); gluniform3fv(focusloc, 1, glm::value_ptr(&v[0])); 

Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -