Gareth Rees scored 84 not out on his first appearance of the season as Glamorgan hit back against Hampshire at Cardiff.