From d0447fd97e665004de82c29782e9bfdf3adc48e3 Mon Sep 17 00:00:00 2001 From: Guido L Date: Sun, 6 Sep 2015 01:48:42 +0200 Subject: [PATCH] Ensure that we have a working OpenGL context. --- OpenRA.Platforms.Default/Sdl2GraphicsDevice.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenRA.Platforms.Default/Sdl2GraphicsDevice.cs b/OpenRA.Platforms.Default/Sdl2GraphicsDevice.cs index 71d2b89de0..286aa65081 100644 --- a/OpenRA.Platforms.Default/Sdl2GraphicsDevice.cs +++ b/OpenRA.Platforms.Default/Sdl2GraphicsDevice.cs @@ -75,7 +75,9 @@ namespace OpenRA.Platforms.Default } context = SDL.SDL_GL_CreateContext(window); - SDL.SDL_GL_MakeCurrent(window, context); + if (context == IntPtr.Zero || SDL.SDL_GL_MakeCurrent(window, context) < 0) + throw new InvalidOperationException("Can not create OpenGL context. (Error: {0})".F(SDL.SDL_GetError())); + GraphicsContext.CurrentContext = context; GL.LoadAll();