mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-03-08 10:10:00 +00:00
SDL_GL_GetAttribute requires a valid context
Calling SDL_GL_GetAttribute when context construction has failed leads to erroneous behavior. This call should only be made when a context has been constructed correctly.
This commit is contained in:
parent
5b5a395bbd
commit
f77a6b11c3
|
@ -65,16 +65,17 @@ namespace OpenTK.Platform.SDL2
|
||||||
{
|
{
|
||||||
SetGLAttributes(mode, shareContext, major, minor, flags);
|
SetGLAttributes(mode, shareContext, major, minor, flags);
|
||||||
SdlContext = new ContextHandle(SDL.GL.CreateContext(Window.Handle));
|
SdlContext = new ContextHandle(SDL.GL.CreateContext(Window.Handle));
|
||||||
|
if (SdlContext == ContextHandle.Zero)
|
||||||
|
{
|
||||||
|
var error = SDL.GetError();
|
||||||
|
Debug.Print("SDL2 failed to create OpenGL context: {0}", error);
|
||||||
|
throw new GraphicsContextException(error);
|
||||||
|
}
|
||||||
|
|
||||||
Mode = GetGLAttributes(SdlContext, out flags);
|
Mode = GetGLAttributes(SdlContext, out flags);
|
||||||
Debug.Print("SDL2 created GraphicsContext (mode: {0}) (flags: {1}",
|
Debug.Print("SDL2 created GraphicsContext (mode: {0}) (flags: {1})",
|
||||||
Mode, flags);
|
Mode, flags);
|
||||||
}
|
}
|
||||||
if (SdlContext == ContextHandle.Zero)
|
|
||||||
{
|
|
||||||
var error = SDL.GetError();
|
|
||||||
Debug.Print("SDL2 failed to create OpenGL context: {0}", error);
|
|
||||||
throw new GraphicsContextException(error);
|
|
||||||
}
|
|
||||||
Handle = GraphicsContext.GetCurrentContext();
|
Handle = GraphicsContext.GetCurrentContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue