mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-08-03 21:41:03 +00:00
Fixed unsetting current context in SDL2
SDL_GL_MakeCurrent(IntPtr.Zero, IntPtr.Zero) is the correct way to remove the current OpenGL context from the calling thread. Fixes threaded rendering on Windows.
This commit is contained in:
parent
a6b97f9b38
commit
4d7ba20a03
|
@ -180,8 +180,17 @@ namespace OpenTK.Platform.SDL2
|
||||||
|
|
||||||
public override void MakeCurrent(IWindowInfo window)
|
public override void MakeCurrent(IWindowInfo window)
|
||||||
{
|
{
|
||||||
var sdl_window = window as Sdl2WindowInfo;
|
int result = 0;
|
||||||
if (SDL.SDL_GL_MakeCurrent(sdl_window != null ? sdl_window.Handle : IntPtr.Zero, SdlContext.Handle) < 0)
|
if (window != null)
|
||||||
|
{
|
||||||
|
result = SDL.SDL_GL_MakeCurrent(window.Handle, SdlContext.Handle);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = SDL.SDL_GL_MakeCurrent(IntPtr.Zero, IntPtr.Zero);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result < 0)
|
||||||
{
|
{
|
||||||
Debug.Print("SDL2 MakeCurrent failed with: {0}", SDL.SDL_GetError());
|
Debug.Print("SDL2 MakeCurrent failed with: {0}", SDL.SDL_GetError());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue