add glError.h and CHECK_GL_CALL; fixed some bugs in glconvert and some gl function calls; fixed some bugs in template