This should get you started using the Uniform Buffer Object to store the array. Note that GL requires that UBOs have a minimum capacity of 16 KiB, a maximum capacity can be requested through GL_MAX_UNIFORM_BLOCK_SIZE .
An example of a fragmented shader (UBOs require OpenGL 3.1):
OpenGL Code
const int MY_ARRAY_SIZE = 512; GLuint myArrayUBO; glGenBuffers (1, &myArrayUBO);
I probably forgot something, there is a reason why I do not write textbooks. If you have any problems with this, leave a comment.
UPDATE:
Note that 0 used in glUniformBlockBinding (...) and glBindBufferBase (...) is the global identifier of the anchor point. When used in conjunction with the std140 layout std140 this means that you can use this UBO in any GLSL program where you bind one of your uniform blocks to this anchor point ( 0 ). This is great when you want to share something like your ModelView and Projection matrices between dozens of different GLSL programs.
source share