You provided very little information about what you are using. The short version of solution would be to add the uniform into your fragment shader that represents the color and then output the color in the fragment shader. At least seeing your shaders might help.
So to see where the shader color output is:
gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0); // Will output white color (RGBA values)
To change it something you can modify you will need to add the uniform so your shader will look something like this:
uniform lowp vec4 uniformColor;
void main() {
gl_FragColor = uniformColor;
}
Now this means you can control the uniformColor
from the CPU using openGL API . You need to use the current program, find the uniform location and pass the value you want to set as a color:
GLuint myShaderProgram; // Your program ID you got when creating the program.
GLfloat colorToSet[4] = {1.0f, .0f, .0f, 1.0f}; // Set whatever color, this should output red.
glUseProgram(myShaderProgram);
int uniformLocation = glGetUniformLocation(myShaderProgram, "uniformColor");
if(uniformLocation < 0) {
// Uniform locations must be 0 or greater, otherwise the uniform was not found in the shader or some other error occured
// TODO: handle exception
}
else {
glUniform4f(uniformLocation, colorToSet[0], colorToSet[1], colorToSet[2], colorToSet[3]);
}
... continue with drawing (glDrawArrays) ...