Esempio n. 1
0
        public static void Initialize(IGLContextSource glContextSource)
        {
            _gl = GL.GetApi(glContextSource);

            // FIXME: Debugger currently doesn't like us specifying a callback.
            if (!Debugger.IsAttached)
            {
                Gl.Enable(GLEnum.DebugOutput);
                Gl.DebugMessageCallback(
                    (source, type, id, severity, length, message, userParam) =>
                    OnDebugOutput?.Invoke(
                        (DebugSource)source, (DebugType)type, id,
                        (DebugSeverity)severity, Marshal.PtrToStringAnsi(message, length)),
                    false);
            }

            Gl.Enable(EnableCap.CullFace);
            Gl.CullFace(CullFaceMode.Back);

            Gl.Enable(EnableCap.DepthTest);
            Gl.DepthFunc(DepthFunction.Less);

            Gl.Enable(EnableCap.Blend);
            Gl.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);
        }
Esempio n. 2
0
        public static void Initialize()
        {
            GL = Silk.NET.OpenGL.GL.GetApi();

            GL.Enable(GLEnum.DebugOutput);
            unsafe {
                GL.DebugMessageCallback(
                    (source, type, id, severity, length, message, userParam) =>
                    OnDebugOutput?.Invoke(
                        (DebugSource)source, (DebugType)type, id,
                        (DebugSeverity)severity, Marshal.PtrToStringAnsi(message) !),
                    null);
            }

            GL.Enable(EnableCap.CullFace);
            GL.CullFace(CullFaceMode.Back);

            GL.Enable(EnableCap.DepthTest);
            GL.DepthFunc(DepthFunction.Less);

            GL.Enable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);
        }