Moved matrices uniform setting out of paint function