Example #1
0
        public static void SetupDebugCallback(ITextOutputGlob textOutput)
        {
            _debugOutput = textOutput;
            GL.Enable(EnableCap.DebugOutput);
            GL.Enable(EnableCap.DebugOutputSynchronous);

            _callback = DebugMessageCallback;
            GL.DebugMessageCallback(_callback, IntPtr.Zero);
            _maxDebugMessageLength = GL.GetInteger((GetPName)GL_MAX_DEBUG_MESSAGE_LENGTH);
            GL.DebugMessageControl(DebugSourceControl.DontCare, DebugTypeControl.DontCare, DebugSeverityControl.DontCare, 0, new int[1], true);
            GL.DebugMessageControl(DebugSourceControl.DontCare, DebugTypeControl.DebugTypePushGroup, DebugSeverityControl.DontCare, 0, new int[1], false);
            GL.DebugMessageControl(DebugSourceControl.DontCare, DebugTypeControl.DebugTypePopGroup, DebugSeverityControl.DontCare, 0, new int[1], false);
            //GL.DebugMessageControl(DebugSourceControl.DontCare, DebugTypeControl.DontCare, DebugSeverityControl.DontCare, 2, new int[2]
            //{
            //	131185,
            //	131186,
            //}, false);
        }
Example #2
0
        /// <summary>
        /// Creates a new Glob Device. Can only be called once the OpenGL context is already created, for example by creating an OpenTK GameWindow.
        /// </summary>
        /// <param name="textOutput">Text output that will be used by Glob</param>
        /// <param name="fileManager">File manager that will be used by Glob</param>
        public Device(ITextOutputGlob textOutput, IFileManagerGlob fileManager)
        {
            TextOutput  = textOutput;
            FileManager = fileManager;

            DeviceInfo = new DeviceInfo();

            // TODO: move these to DeviceInfo.ToString()
            TextOutput.Print(OutputTypeGlob.Notify, "OpenGL: " + DeviceInfo.OpenGLVersion + " GLSL: " + DeviceInfo.GLSLVersion);
            TextOutput.Print(OutputTypeGlob.Notify, "Renderer: " + DeviceInfo.DeviceRenderer + ", " + DeviceInfo.DeviceVendor);

            // Print extensions
            StringBuilder allExtensionsStr = new StringBuilder();

            foreach (string extension in DeviceInfo.Extensions)
            {
                allExtensionsStr.Append(extension);
                allExtensionsStr.Append(" ");
            }
            TextOutput.Print(OutputTypeGlob.Notify, DeviceInfo.Extensions.Count.ToString() + " GL extensions found");
            TextOutput.Print(OutputTypeGlob.LogOnly, allExtensionsStr.ToString());

            ShaderRepository = new ShaderRepository(this, "#extension GL_ARB_separate_shader_objects : enable\n");
            ShaderRepository.StartFileWatcher(FileManager.GetPathShaderSource(""));

            _bufferBindingManager   = new BufferBindingManager();
            DebugMessageManager     = new DebugMessageManager(true);
            _textureUnit            = new TextureUnitState();
            _currentRasterizerState = new RasterizerState();
            _currentDepthState      = new DepthState();
            _currentBlendState      = new BlendState();

            // Create and bind a global vertex array object
            _vaoGlobal = GL.GenVertexArray();
            GL.BindVertexArray(_vaoGlobal);
        }