Converting my glTest from Perl to C++