mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 19:35:29 +00:00
Added support for OpenGL ES through SDL2
If SDL2 is supported, the PlatformFactory will now use it for creating the OpenGL ES context. Previously, it would revert to the native drivers when GraphicsContextFlag.Embedded was specified.
This commit is contained in:
parent
f6da957639
commit
d217e379d4
|
@ -799,6 +799,7 @@
|
|||
<Compile Include="Platform\SDL2\Sdl2WindowInfo.cs" />
|
||||
<Compile Include="Platform\MacOS\Cgl.cs" />
|
||||
<Compile Include="Platform\SDL2\Sdl2.cs" />
|
||||
<Compile Include="Platform\Egl\EglSdl2PlatformFactory.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
|
|
46
Source/OpenTK/Platform/Egl/EglSdl2PlatformFactory.cs
Normal file
46
Source/OpenTK/Platform/Egl/EglSdl2PlatformFactory.cs
Normal file
|
@ -0,0 +1,46 @@
|
|||
#region License
|
||||
//
|
||||
// The Open Toolkit Library License
|
||||
//
|
||||
// Copyright (c) 2006 - 2013 Stefanos Apostolopoulos
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights to
|
||||
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
// the Software, and to permit persons to whom the Software is furnished to do
|
||||
// so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Platform.SDL2;
|
||||
|
||||
namespace OpenTK.Platform.Egl
|
||||
{
|
||||
|
||||
class EglSdl2PlatformFactory : Sdl2Factory
|
||||
{
|
||||
public override OpenTK.Graphics.IGraphicsContext CreateGLContext(
|
||||
GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering,
|
||||
int major, int minor, GraphicsContextFlags flags)
|
||||
{
|
||||
flags |= GraphicsContextFlags.Embedded;
|
||||
return base.CreateGLContext(mode, window, shareContext, directRendering, major, minor, flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -53,14 +53,21 @@ namespace OpenTK.Platform
|
|||
else if (Configuration.RunningOnX11) Default = new X11.X11Factory();
|
||||
else Default = new UnsupportedPlatform();
|
||||
|
||||
if (Egl.Egl.IsSupported)
|
||||
if (Configuration.Sdl2Supported)
|
||||
{
|
||||
Embedded = new Egl.EglSdl2PlatformFactory();
|
||||
}
|
||||
else if (Egl.Egl.IsSupported)
|
||||
{
|
||||
if (Configuration.RunningOnWindows) Embedded = new Egl.EglWinPlatformFactory();
|
||||
else if (Configuration.RunningOnMacOS) Embedded = new Egl.EglMacPlatformFactory();
|
||||
else if (Configuration.RunningOnX11) Embedded = new Egl.EglX11PlatformFactory();
|
||||
else Embedded = new UnsupportedPlatform();
|
||||
}
|
||||
else Embedded = new UnsupportedPlatform();
|
||||
else
|
||||
{
|
||||
Embedded = new UnsupportedPlatform();
|
||||
}
|
||||
|
||||
if (Default is UnsupportedPlatform && !(Embedded is UnsupportedPlatform))
|
||||
Default = Embedded;
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace OpenTK.Platform.SDL2
|
|||
return new Sdl2DisplayDeviceDriver();
|
||||
}
|
||||
|
||||
public IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
|
||||
virtual public IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
|
||||
{
|
||||
return new Sdl2GraphicsContext(mode, window, shareContext, major, minor, flags);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue