I am starting to learn qt-5 and trying to link two VBO’s to a vertex shader, one for position and another for color. I have declared them as in variables in the vertex shader under the names vertex
and color
. the problem is when using glGetAttribLocation
, only vertex seems to be working even tho the two lines of code are written exactly the same.
vertexLoc = glGetAttribLocation (program->programId(), "vertex")// links it correctly but
colorLoc = glGetAttribLocation (program->programId(), "color") //does not
the error message reads:
error: 'colorLoc' was not declared in this scope
my vertex and fragment shaders are
#version 330 core
in vec3 vertex;
in vec3 color;
out fcolor;
void main() {
gl_Position = vec4 (vertex, 1.0);
fcolor=color;
}
and
#version 330 core
in vec3 fcolor;
out vec4 FragColor;
void main() {
FragColor = vec4(fcolor, 1);
}
respectivly
Gabriel Martínez Aïtcin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.