updated mainGL example to use basic class factory