コード例 #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);
        }
コード例 #2
0
 public static GL GetApi(IGLContextSource contextSource) => GetApi
 (
コード例 #3
0
 public static GL CreateOpenGL(this IGLContextSource src) => GL.GetApi(src);