예제 #1
0
        private void FormDebugging_Load(object sender, EventArgs e)
        {
            frmWhiteBoard = new FormWhiteBoard();
            frmWhiteBoard.Show();

            byte x;

            x = GL.IsEnabled(GL.GL_DEBUG_OUTPUT);// x is 1

            GL.Disable(GL.GL_DEBUG_OUTPUT);
            x = GL.IsEnabled(GL.GL_DEBUG_OUTPUT);// x is 0

            GL.Enable(GL.GL_DEBUG_OUTPUT);
            x = GL.IsEnabled(GL.GL_DEBUG_OUTPUT);                 // x is 1

            x = GL.IsEnabled(GL.GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB); // x is 0

            GL.Disable(GL.GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
            x = GL.IsEnabled(GL.GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);// x is 0

            GL.Enable(GL.GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
            x = GL.IsEnabled(GL.GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);// x is 1

            // 必须是struct
            UserParamStruct data = new UserParamStruct()
            {
                integer = 123, handle = this.glCanvas1.Handle
            };

            this.userParamInstance = System.Runtime.InteropServices.GCHandle.Alloc(
                data, System.Runtime.InteropServices.GCHandleType.Pinned);
            IntPtr ptr = userParamInstance.AddrOfPinnedObject();

            GL.DebugMessageCallback(this.callbackProc, ptr);

            GL.DebugMessageControl(
                Enumerations.DebugMessageControlSource.DONT_CARE,
                Enumerations.DebugMessageControlType.DONT_CARE,
                Enumerations.DebugMessageControlSeverity.DONT_CARE,
                0, null, true);

            StringBuilder builder = new StringBuilder();

            builder.Append("hello, this is app!");
            GL.DebugMessageInsert(
                Enumerations.DebugSource.DEBUG_SOURCE_APPLICATION_ARB,
                Enumerations.DebugType.DEBUG_TYPE_OTHER_ARB,
                0x4752415A,
                //Enumerations.DebugSeverity.DEBUG_SEVERITY_NOTIFICATION_ARB,// not valid
                Enumerations.DebugSeverity.DEBUG_SEVERITY_HIGH_ARB,
                //Enumerations.DebugSeverity.DEBUG_SEVERITY_MEDIUM_ARB,
                //Enumerations.DebugSeverity.DEBUG_SEVERITY_LOW_ARB,
                -1,
                builder);
        }
예제 #2
0
        private void FormDebugging_Load(object sender, EventArgs e)
        {
            frmWhiteBoard = new FormWhiteBoard();
            frmWhiteBoard.Show();

            byte x;
            x = GL.IsEnabled(GL.GL_DEBUG_OUTPUT);// x is 1

            GL.Disable(GL.GL_DEBUG_OUTPUT);
            x = GL.IsEnabled(GL.GL_DEBUG_OUTPUT);// x is 0

            GL.Enable(GL.GL_DEBUG_OUTPUT);
            x = GL.IsEnabled(GL.GL_DEBUG_OUTPUT);// x is 1

            x = GL.IsEnabled(GL.GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);// x is 0

            GL.Disable(GL.GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
            x = GL.IsEnabled(GL.GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);// x is 0

            GL.Enable(GL.GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
            x = GL.IsEnabled(GL.GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);// x is 1

            // 必须是struct
            UserParamStruct data = new UserParamStruct() { integer = 123, handle = this.glCanvas1.Handle };
            this.userParamInstance = System.Runtime.InteropServices.GCHandle.Alloc(
                data, System.Runtime.InteropServices.GCHandleType.Pinned);
            IntPtr ptr = userParamInstance.AddrOfPinnedObject();

            GL.DebugMessageCallback(this.callbackProc, ptr);

            GL.DebugMessageControl(
                 Enumerations.DebugMessageControlSource.DONT_CARE,
                 Enumerations.DebugMessageControlType.DONT_CARE,
                  Enumerations.DebugMessageControlSeverity.DONT_CARE,
                  0, null, true);

            StringBuilder builder = new StringBuilder();
            builder.Append("hello, this is app!");
            GL.DebugMessageInsert(
                Enumerations.DebugSource.DEBUG_SOURCE_APPLICATION_ARB,
                Enumerations.DebugType.DEBUG_TYPE_OTHER_ARB,
                0x4752415A,
                //Enumerations.DebugSeverity.DEBUG_SEVERITY_NOTIFICATION_ARB,// not valid
                Enumerations.DebugSeverity.DEBUG_SEVERITY_HIGH_ARB,
                //Enumerations.DebugSeverity.DEBUG_SEVERITY_MEDIUM_ARB,
                //Enumerations.DebugSeverity.DEBUG_SEVERITY_LOW_ARB,
                -1,
                builder);
        }