Add a glcheck() function to check for GL errors