The best way to color objects individually is to pass a uniform (like you did with myPMVMatrix
) containing the color you want, for each object.
You would have a uniform vec4 objectColor
in the fragment shader that you can directly use inf gl_FragColor
.
The fragment shader would look like:
uniform mediump vec4 myColor;\
void main (void)\
{\
gl_FragColor = myColor;\
}";
and you would pass it exactly like you passed your myPMVMatrix
, just with the word myColor
instead of myPMVMatrix
.