mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-25 06:45:31 +00:00
b7390e11d2
Improved CreateDummyContext logic to detect and use the context handle of the current thread or a specified handle. Removed GetCurrentContext() methods from platform-specific context implementations (everything now goes through the relevant IPlatformFactories).
90 lines
3.2 KiB
C#
90 lines
3.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace OpenTK.Platform
|
|
{
|
|
using Graphics;
|
|
|
|
static class Factory
|
|
{
|
|
static IPlatformFactory implementation;
|
|
|
|
static Factory()
|
|
{
|
|
if (Configuration.RunningOnWindows) implementation = new Windows.WinFactory();
|
|
else if (Configuration.RunningOnX11) implementation = new X11.X11Factory();
|
|
else if (Configuration.RunningOnMacOS) implementation = new MacOS.MacOSFactory();
|
|
else implementation = new UnsupportedPlatform();
|
|
}
|
|
|
|
internal static INativeGLWindow CreateNativeGLWindow()
|
|
{
|
|
return implementation.CreateGLNative();
|
|
}
|
|
|
|
internal static IGLControl CreateGLControl(GraphicsMode mode, GLControl owner)
|
|
{
|
|
return implementation.CreateGLControl(mode, owner);
|
|
}
|
|
|
|
internal static IDisplayDeviceDriver CreateDisplayDeviceDriver()
|
|
{
|
|
return implementation.CreateDisplayDeviceDriver();
|
|
}
|
|
|
|
internal static IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
|
|
{
|
|
return implementation.CreateGLContext(mode, window, shareContext, directRendering, major, minor, flags);
|
|
}
|
|
|
|
internal static GraphicsContext.GetCurrentContextDelegate CreateGetCurrentGraphicsContext()
|
|
{
|
|
return implementation.CreateGetCurrentGraphicsContext();
|
|
}
|
|
|
|
internal static IGraphicsMode CreateGraphicsMode()
|
|
{
|
|
return implementation.CreateGraphicsMode();
|
|
}
|
|
|
|
class UnsupportedPlatform : IPlatformFactory
|
|
{
|
|
#region IPlatformFactory Members
|
|
|
|
public INativeGLWindow CreateGLNative()
|
|
{
|
|
throw new PlatformNotSupportedException("Please, refer to http://www.opentk.com for more information.");
|
|
}
|
|
|
|
public IGLControl CreateGLControl(GraphicsMode mode, GLControl owner)
|
|
{
|
|
throw new PlatformNotSupportedException("Please, refer to http://www.opentk.com for more information.");
|
|
}
|
|
|
|
public IDisplayDeviceDriver CreateDisplayDeviceDriver()
|
|
{
|
|
throw new PlatformNotSupportedException("Please, refer to http://www.opentk.com for more information.");
|
|
}
|
|
|
|
public IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool DirectRendering, int major, int minor, GraphicsContextFlags flags)
|
|
{
|
|
throw new PlatformNotSupportedException("Please, refer to http://www.opentk.com for more information.");
|
|
}
|
|
|
|
public GraphicsContext.GetCurrentContextDelegate CreateGetCurrentGraphicsContext()
|
|
{
|
|
throw new PlatformNotSupportedException("Please, refer to http://www.opentk.com for more information.");
|
|
}
|
|
|
|
|
|
public IGraphicsMode CreateGraphicsMode()
|
|
{
|
|
throw new PlatformNotSupportedException("Please, refer to http://www.opentk.com for more information.");
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
}
|