This project is read-only.

Debug code not quite right?

Jan 14, 2012 at 5:26 PM

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:

        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)
Although it might make sense to not call PreGLCall/PostGLCall at all for things like glVertex which can only be called inside glBegin-glEnd.

Jan 16, 2012 at 4:53 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jan 16, 2012 at 4:54 PM

Makes sense mbraca - have copied this to a new work item