It seems to me that the debug code in OpenGL.cs isn't quite right. I think Begin() should be:
public void Begin(uint mode)
// Do PreGLCall now, and PostGLCall AFTER End()
// Let's remember something important here - you CANNOT call 'glGetError'
// between glBegin and glEnd. So we set the 'begun' flag - this'll
// turn off error reporting until glEnd.
// Set the begun flag.
insideGLBegin = true;
And End() should be:
public void End()
// Clear the begun flag.
insideGLBegin = false;
// This matches Begin()'s PreGLCall()
And PreGLCall() should be:
Although it might make sense to not call PreGLCall/PostGLCall at all for things like glVertex which can only be called inside glBegin-glEnd.
protected virtual void PreGLCall()
// If we are in debug mode, clear the error flag.
// GetError() should not be called at all inside glBegin-glEnd
if (insideGLBegin == false)
// If we are not the current OpenGL object, make ourselves current.
if (currentOpenGLInstance != this)