aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.OpenGL/IOpenGLContext.cs
blob: b1f6d72d236bccd8123f6bceab6165d69bcef685 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using Ryujinx.Graphics.OpenGL.Helper;
using System;

namespace Ryujinx.Graphics.OpenGL
{
    public interface IOpenGLContext : IDisposable
    {
        void MakeCurrent();

        // TODO: Support more APIs per platform.
        static bool HasContext()
        {
            if (OperatingSystem.IsWindows())
            {
                return WGLHelper.GetCurrentContext() != IntPtr.Zero;
            }
            else if (OperatingSystem.IsLinux())
            {
                return GLXHelper.GetCurrentContext() != IntPtr.Zero;
            }
            else
            {
                return false;
            }
        }
    }
}