Right way to check for errors
How should I check for errors? In release mode I cant check them with while(...)glGetError after every single gl call. I can write macros that will only check in debug mode but some important calls like glCompileShader are still need to be checked in release mode too. ....so it will be a mess.
Should I check only once per frame?
What about GL_ARB_debug_output? I couldnt find much information about it?
This does work but traps to a callback so it can be hard to continue running the program so the user can exit gracefully.
I have a series of macros for error checking so I can selectively remove error checks; this way I leave critical ones in the production version but have a lot more in debug mode. I would certainly recommend more than just 1 per frame.
For debugging use, might use ARB_debug_output. This gives you a nice callback for every error,warning,info,etc. (you control what level) so you can break inside of an error as its happening, look at/dump the stack trace, and inspect in a debugger what your program has done wrong.
For those few times you'd like to check for an error in release mode, just use glGetError. That said, glCompileShader is not one of those times. You get success and failure of the compile through a different route: glGetShaderiv( shader, GL_COMPILE_STATUS, &result ). You can of course query the log as well. And this is all independent of the OpenGL error handling mechanism which is for coding errors/problems (as opposed to shader compilation/linking problems).