[C++] Passing array to opengl
I don't have much experience with glsl yet and I've run into a problem I can't figure out.
I have an array that contains 4 integer values for each vertex of my mesh.
Since these values never change, I figured the best way of doing it would be by using a buffer.
Below isn't the actual code, just a representation.
Generating the buffer(C++):
When I retrieve the values using glGetBufferSubData they're correct, so I'm assuming so far it's fine.
int numValues = vertexCount *4;
int *values = new int[numValues];
values[i] = 0; // For testing purposes
Inside the shader(GLSL):
layout(location = 3) in int values;
Passing the buffer(C++):
3, // location inside the shader
4, // 4 integer values per vertex
However, as far as I can tell, the values inside the 'values' array in the shader are incorrect.
I wouldn't be surprised if I did this entirely wrong, although it looks fine to me.