final ColorMaskStateRecord record = (ColorMaskStateRecord) context.getStateRecord(StateType.ColorMask);
context.setCurrentState(StateType.ColorMask, state);
if (state.isEnabled()) {
if (!record.isValid() || !record.is(state.getRed(), state.getGreen(), state.getBlue(), state.getAlpha())) {
gl.glColorMask(state.getRed(), state.getGreen(), state.getBlue(), state.getAlpha());
record.set(state.getRed(), state.getGreen(), state.getBlue(), state.getAlpha());
}
} else if (!record.isValid() || !record.is(true, true, true, true)) {
gl.glColorMask(true, true, true, true);
record.set(true, true, true, true);