Closed karyon closed 5 years ago
I think such error handling would be the job of globjects. And you're right, if no OpenGL object can be created in either driver or graphics card, all the following operations become nonsense. As globjects itself can't recover from such an issue, throwing exceptions may be reasonable.
We actually had this problem a couple of days ago and I think it was because the OpenGL driver couldn't allocate any more memory. Nasty issue that would have been directly visible with actual error messages or even exceptions.
fwiw, in my case i called those methods in the wrong thread where no opengl context was active. probably not the rarest of mistakes as well.
For this case we had another feature that detects when globjects desyncy with the current OpenGL context but I disabled it as it bloated our log files without being an actual issue. I'm still not sure if the driver didn't like such big amounts of current context calls or if there were actual errors in our context handling code...
This is probably more a feature request but nonetheless:
glCreateShader (and glCreateProgram and possibly others) return 0 to indicate errors.
if would be nice if globjects would check for that and generate an exception.
or actually, would that be glbinding's job?