mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-12 08:35:38 +00:00
Moved DummyGLContext and DummyGLControl to the OpenTK/Platform/Dummy directory and namespace.
Fixed a regression where the GLControl would try to instantiate a normal context inside the VS designer, instead of a dummy one.
This commit is contained in:
parent
829d929ab3
commit
033d4722af
|
@ -53,13 +53,13 @@ namespace OpenTK
|
||||||
/// <param name="mode">The OpenTK.Graphics.GraphicsMode of the control.</param>
|
/// <param name="mode">The OpenTK.Graphics.GraphicsMode of the control.</param>
|
||||||
public GLControl(GraphicsMode mode)
|
public GLControl(GraphicsMode mode)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
SetStyle(ControlStyles.Opaque, true);
|
||||||
|
SetStyle(ControlStyles.UserPaint, true);
|
||||||
this.SetStyle(ControlStyles.Opaque, true);
|
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||||
this.SetStyle(ControlStyles.UserPaint, true);
|
|
||||||
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
|
||||||
DoubleBuffered = false;
|
DoubleBuffered = false;
|
||||||
|
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
this.format = mode;
|
this.format = mode;
|
||||||
|
|
||||||
// On Windows, you first need to create the window, then set the pixel format.
|
// On Windows, you first need to create the window, then set the pixel format.
|
||||||
|
@ -69,10 +69,12 @@ namespace OpenTK
|
||||||
// it would be better to decouple selection from context creation, which will allow us
|
// it would be better to decouple selection from context creation, which will allow us
|
||||||
// to clean up this hacky code. The best option is to do this along with multisampling
|
// to clean up this hacky code. The best option is to do this along with multisampling
|
||||||
// support.
|
// support.
|
||||||
if (Configuration.RunningOnWindows)
|
if (DesignMode)
|
||||||
implementation = new OpenTK.Platform.Windows.WinGLControl(mode, this);
|
implementation = new Platform.Dummy.DummyGLControl();
|
||||||
|
else if (Configuration.RunningOnWindows)
|
||||||
|
implementation = new Platform.Windows.WinGLControl(mode, this);
|
||||||
else if (Configuration.RunningOnX11)
|
else if (Configuration.RunningOnX11)
|
||||||
implementation = new OpenTK.Platform.X11.X11GLControl(mode, this);
|
implementation = new Platform.X11.X11GLControl(mode, this);
|
||||||
else if (Configuration.RunningOnOSX)
|
else if (Configuration.RunningOnOSX)
|
||||||
throw new PlatformNotSupportedException("Refer to http://www.opentk.com for more information.");
|
throw new PlatformNotSupportedException("Refer to http://www.opentk.com for more information.");
|
||||||
|
|
||||||
|
@ -89,10 +91,7 @@ namespace OpenTK
|
||||||
{
|
{
|
||||||
base.OnHandleCreated(e);
|
base.OnHandleCreated(e);
|
||||||
|
|
||||||
if (DesignMode)
|
this.Context = implementation.CreateContext();
|
||||||
this.Context = new DummyGLContext(null);
|
|
||||||
else
|
|
||||||
this.Context = implementation.CreateContext();
|
|
||||||
|
|
||||||
this.window_info = implementation.WindowInfo;
|
this.window_info = implementation.WindowInfo;
|
||||||
this.MakeCurrent();
|
this.MakeCurrent();
|
||||||
|
@ -193,7 +192,7 @@ namespace OpenTK
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
context = new DummyGLContext(format);
|
context = new Platform.Dummy.DummyGLContext(format);
|
||||||
|
|
||||||
this.MakeCurrent();
|
this.MakeCurrent();
|
||||||
(context as IGraphicsContextInternal).LoadAll();
|
(context as IGraphicsContextInternal).LoadAll();
|
||||||
|
|
|
@ -71,11 +71,11 @@ namespace OpenTK.Graphics
|
||||||
}
|
}
|
||||||
|
|
||||||
if (designMode)
|
if (designMode)
|
||||||
implementation = new OpenTK.Platform.DummyGLContext(mode);
|
implementation = new Platform.Dummy.DummyGLContext(mode);
|
||||||
else if (Configuration.RunningOnWindows)
|
else if (Configuration.RunningOnWindows)
|
||||||
implementation = new OpenTK.Platform.Windows.WinGLContext(mode, window, shareContext);
|
implementation = new Platform.Windows.WinGLContext(mode, window, shareContext);
|
||||||
else if (Configuration.RunningOnX11)
|
else if (Configuration.RunningOnX11)
|
||||||
implementation = new OpenTK.Platform.X11.X11GLContext(mode, window, shareContext, DirectRendering);
|
implementation = new Platform.X11.X11GLContext(mode, window, shareContext, DirectRendering);
|
||||||
else
|
else
|
||||||
throw new PlatformNotSupportedException("Please, refer to http://www.opentk.com for more information.");
|
throw new PlatformNotSupportedException("Please, refer to http://www.opentk.com for more information.");
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace OpenTK.Platform
|
namespace OpenTK.Platform.Dummy
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An empty IGraphicsContext implementation to be used inside the Visual Studio designer.
|
/// An empty IGraphicsContext implementation to be used inside the Visual Studio designer.
|
26
Source/OpenTK/Platform/Dummy/DummyGLControl.cs
Normal file
26
Source/OpenTK/Platform/Dummy/DummyGLControl.cs
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
|
namespace OpenTK.Platform.Dummy
|
||||||
|
{
|
||||||
|
class DummyGLControl : IGLControl
|
||||||
|
{
|
||||||
|
#region IGLControl Members
|
||||||
|
|
||||||
|
public OpenTK.Graphics.GraphicsContext CreateContext()
|
||||||
|
{
|
||||||
|
return new GraphicsContext(null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsIdle
|
||||||
|
{
|
||||||
|
get { return false; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public IWindowInfo WindowInfo
|
||||||
|
{
|
||||||
|
get { return new DummyWindowInfo(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
17
Source/OpenTK/Platform/Dummy/DummyWindowInfo.cs
Normal file
17
Source/OpenTK/Platform/Dummy/DummyWindowInfo.cs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace OpenTK.Platform.Dummy
|
||||||
|
{
|
||||||
|
class DummyWindowInfo : IWindowInfo
|
||||||
|
{
|
||||||
|
#region IDisposable Members
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue