mirror of
https://github.com/Ryujinx/GLWidget.git
synced 2024-12-22 14:05:38 +00:00
fix windows
This commit is contained in:
parent
fafd730d29
commit
79133f4812
|
@ -155,6 +155,7 @@ namespace OpenTK
|
|||
|
||||
public void ClearCurrent()
|
||||
{
|
||||
Gdk.GLContext.ClearCurrent();
|
||||
GraphicsContext.MakeCurrent(null);
|
||||
}
|
||||
|
||||
|
@ -169,7 +170,7 @@ namespace OpenTK
|
|||
{
|
||||
try
|
||||
{
|
||||
GraphicsContext.MakeCurrent(WindowInfo);
|
||||
MakeCurrent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -259,7 +260,7 @@ namespace OpenTK
|
|||
if (!_initialized)
|
||||
Initialize();
|
||||
else if (!IsRenderHandler)
|
||||
GraphicsContext.MakeCurrent(WindowInfo);
|
||||
MakeCurrent();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -277,6 +278,8 @@ namespace OpenTK
|
|||
|
||||
private void Initialize()
|
||||
{
|
||||
Toolkit.Init();
|
||||
|
||||
_initialized = true;
|
||||
|
||||
Gdk.GLContext.ClearCurrent();
|
||||
|
@ -302,7 +305,7 @@ namespace OpenTK
|
|||
buffers--;
|
||||
}
|
||||
|
||||
GraphicsMode graphicsMode = new GraphicsMode(colorBufferColorFormat, DepthBPP, StencilBPP, Samples, accumulationColorFormat, buffers, Stereo);
|
||||
GraphicsMode graphicsMode = GraphicsMode.Default;//new GraphicsMode(colorBufferColorFormat, DepthBPP, StencilBPP, Samples, accumulationColorFormat, buffers, Stereo);
|
||||
|
||||
this.Window.EnsureNative();
|
||||
|
||||
|
@ -322,7 +325,7 @@ namespace OpenTK
|
|||
|
||||
// GraphicsContext
|
||||
GraphicsContext = new GraphicsContext(graphicsMode, WindowInfo, GLVersionMajor, GLVersionMinor, GraphicsContextFlags);
|
||||
GraphicsContext.MakeCurrent(WindowInfo);
|
||||
MakeCurrent();
|
||||
|
||||
if (OpenTK.Graphics.GraphicsContext.ShareContexts)
|
||||
{
|
||||
|
@ -345,6 +348,11 @@ namespace OpenTK
|
|||
|
||||
var swap = GraphicsContext.SwapInterval;
|
||||
|
||||
GTKBindingHelper.InitializeGlBindings();
|
||||
|
||||
ClearCurrent();
|
||||
MakeCurrent();
|
||||
|
||||
OnInitialized();
|
||||
}
|
||||
|
||||
|
|
|
@ -47,12 +47,23 @@ namespace OpenTK
|
|||
{
|
||||
if (CurrentPlatform == OSPlatform.Windows)
|
||||
{
|
||||
IntPtr library = OpenTK.Platform.Windows.Functions.LoadLibrary(WglLibrary);
|
||||
return OpenTK.Platform.Windows.Functions.GetProcAddress(library, procName);
|
||||
var ptr = OpenTK.Platform.Windows.Wgl.GetAddress(procName);
|
||||
|
||||
/* var addr = GetProcAddressWgl(procName);
|
||||
if (addr == null || addr == IntPtr.Zero)
|
||||
{
|
||||
var library = UnsafeNativeMethods.LoadLibrary(WglLibrary);
|
||||
|
||||
addr = UnsafeNativeMethods.GetProcAddress(library, procName);
|
||||
}
|
||||
|
||||
return addr;*/
|
||||
|
||||
return ptr;
|
||||
}
|
||||
else if (CurrentPlatform == OSPlatform.Linux)
|
||||
{
|
||||
return OpenTK.Platform.X11.Glx.GetProcAddress(procName);
|
||||
return GetProcAddressGlx(procName);
|
||||
}
|
||||
else if(CurrentPlatform == OSPlatform.OSX)
|
||||
{
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace OpenTK.Platform.Windows
|
|||
private static IntPtr[] EntryPoints;
|
||||
private static string[] EntryPointNames;
|
||||
|
||||
internal const string Library = "OPENGL32.DLL";
|
||||
internal const string Library = "opengl32.dll";
|
||||
|
||||
private readonly static Dictionary<string, bool> extensions =
|
||||
new Dictionary<string, bool>();
|
||||
|
|
|
@ -396,7 +396,9 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
Debug.WriteLine(mode.Index.ToString());
|
||||
|
||||
if (!Functions.SetPixelFormat(window.DeviceContext, (int)mode.Index.Value, ref pfd))
|
||||
var index = Functions.ChoosePixelFormat(window.DeviceContext, ref pfd);
|
||||
|
||||
if (!Functions.SetPixelFormat(window.DeviceContext, index, ref pfd))
|
||||
{
|
||||
throw new GraphicsContextException(String.Format(
|
||||
"Requested GraphicsMode not available. SetPixelFormat error: {0}",
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<ReleaseVersion>1.1</ReleaseVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="GtkSharp" Version="3.22.25.56" />
|
||||
|
|
|
@ -143,7 +143,8 @@ namespace GLWidgetTestGTK3
|
|||
Samples = 4,
|
||||
GLVersionMajor = 3,
|
||||
GLVersionMinor = 3,
|
||||
GraphicsContextFlags = GraphicsContextFlags.Default
|
||||
GraphicsContextFlags = GraphicsContextFlags.ForwardCompatible | GraphicsContextFlags.Debug,
|
||||
IsRenderHandler = true
|
||||
};
|
||||
|
||||
this.MainGLWidget.Events |=
|
||||
|
@ -351,6 +352,8 @@ namespace GLWidgetTestGTK3
|
|||
GLInit = true;
|
||||
//GLib.Idle.Add(OnIdleProcessMain);
|
||||
|
||||
MainGLWidget.ClearCurrent();
|
||||
|
||||
System.Threading.Thread thread = new System.Threading.Thread(Start);
|
||||
thread.Start();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue