only query for the extension we need

This commit is contained in:
Matthias Mailänder
2014-05-04 11:26:55 +02:00
parent dc2d1287a7
commit a5422feced

View File

@@ -31,15 +31,6 @@ namespace OpenRA.Renderer.Sdl2
public class Sdl2GraphicsDevice : IGraphicsDevice public class Sdl2GraphicsDevice : IGraphicsDevice
{ {
static string[] requiredExtensions =
{
// TODO: not ARB anymore
"GL_ARB_vertex_shader",
"GL_ARB_fragment_shader",
"GL_ARB_vertex_buffer_object",
"GL_EXT_framebuffer_object"
};
Size size; Size size;
Sdl2Input input; Sdl2Input input;
IntPtr context, window; IntPtr context, window;
@@ -90,15 +81,11 @@ namespace OpenRA.Renderer.Sdl2
GL.LoadAll(); GL.LoadAll();
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
var extensions = GL.GetString(StringName.Extensions); if (SDL.SDL_GL_ExtensionSupported("GL_EXT_framebuffer_object") == SDL.SDL_bool.SDL_FALSE)
if (extensions == null)
Console.WriteLine("Failed to fetch GL_EXTENSIONS, this is bad.");
var missingExtensions = requiredExtensions.Where(r => !extensions.Contains(r)).ToArray();
if (missingExtensions.Any())
{ {
ErrorHandler.WriteGraphicsLog("Unsupported GPU: Missing extensions: {0}".F(missingExtensions.JoinWith(","))); ErrorHandler.WriteGraphicsLog("OpenRA requires the OpenGL extension GL_EXT_framebuffer_object.\n"
throw new InvalidProgramException("Unsupported GPU. See graphics.log for details."); +"Please try updating your GPU driver to the latest version provided by the manufacturer.");
throw new InvalidProgramException("Missing OpenGL extension GL_EXT_framebuffer_object. See graphics.log for details.");
} }
GL.EnableClientState(ArrayCap.VertexArray); GL.EnableClientState(ArrayCap.VertexArray);