i'm a beginner in OpenGL, and i write a vertex shader and do other things like compiling shader.
Vertex shader:
in vec4 vPosition;
in vec4 vColor;
out vec4 Color;
void main(void){
gl_Position = vPosition;
Color = vColor;
}
After i write this code in C++:
GLuint PositionID = glGetAttribLocation(SProgram, "vPosition");
GLuint ColorID = glGetAttribLocation(SProgram, "vColor");
cout << "vPosition location: " << PositionID << endl << "vColor location: " << ColorID << endl;
And result was pretty interesting, two same locations:
vPosition location: 4294967295
vColor location: 4294967295
What is why of that?
Actually the return type of glGetAttribLocation
is not GLuint
but GLint
(which is signed).
So 4294967295
it's indeed -1
which means that a problem occurred somewhere. Causes could be many:
It's hard to tell the cause since we can't guess your code but the problem is somewhere else.