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:
Stefanos A. 2013-10-02 16:26:47 +02:00
parent a6b97f9b38
commit 4d7ba20a03

View file

@ -180,8 +180,17 @@ namespace OpenTK.Platform.SDL2
public override void MakeCurrent(IWindowInfo window)
{
var sdl_window = window as Sdl2WindowInfo;
if (SDL.SDL_GL_MakeCurrent(sdl_window != null ? sdl_window.Handle : IntPtr.Zero, SdlContext.Handle) < 0)
int result = 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());
}