Creates the base shader and do some basic test on the parameters.
if (colors.length < 2) {
throw new IllegalArgumentException("needs >= 2 number of colors");
}
if (positions != null && colors.length != positions.length) {
throw new IllegalArgumentException("color and position arrays must be of equal length");
}
if (positions == null) {
float spacing = 1.f / (colors.length - 1);
positions = new float[colors.length];
positions[0] = 0.f;
positions[colors.length-1] = 1.f;
for (int i = 1; i < colors.length - 1 ; i++) {
positions[i] = spacing * i;
}
}
mColors = colors;
mPositions = positions;