Use CHECK_ERROR on every GL call

We need to check for GL errors after every GL call. So I have added a wrapper macro around every GL call.

This fixes one of the issues from #639