Move WriteGraphicsLog to OpenGL.

This commit is contained in:
Paul Chote
2015-12-28 10:57:43 +00:00
parent 4ec200b3a1
commit d96a32a89f
4 changed files with 26 additions and 26 deletions

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Platforms.Default
Console.WriteLine("Detected OpenGL version: {0}.{1}".F(major, minor));
if (major < 2)
{
WriteGraphicsLog("OpenRA requires OpenGL version 2.0 or greater and detected {0}.{1}".F(major, minor));
OpenGL.WriteGraphicsLog("OpenRA requires OpenGL version 2.0 or greater and detected {0}.{1}".F(major, minor));
throw new InvalidProgramException("OpenGL Version Error: See graphics.log for details.");
}
}
@@ -42,31 +42,9 @@ namespace OpenRA.Platforms.Default
if (n != OpenGL.GL_NO_ERROR)
{
var error = "GL Error: {0}\n{1}".F(n, new StackTrace());
WriteGraphicsLog(error);
OpenGL.WriteGraphicsLog(error);
throw new InvalidOperationException("OpenGL Error: See graphics.log for details.");
}
}
public static void WriteGraphicsLog(string message)
{
Log.Write("graphics", message);
Log.Write("graphics", "");
Log.Write("graphics", "OpenGL Information:");
var vendor = OpenGL.glGetString(OpenGL.GL_VENDOR);
Log.Write("graphics", "Vendor: {0}", vendor);
if (vendor.Contains("Microsoft"))
{
var msg = "";
msg += "Note: The default driver provided by Microsoft does not include full OpenGL support.\n";
msg += "Please install the latest drivers from your graphics card manufacturer's website.\n";
Log.Write("graphics", msg);
}
Log.Write("graphics", "Renderer: {0}", OpenGL.glGetString(OpenGL.GL_RENDERER));
Log.Write("graphics", "GL Version: {0}", OpenGL.glGetString(OpenGL.GL_VERSION));
Log.Write("graphics", "Shader Version: {0}", OpenGL.glGetString(OpenGL.GL_SHADING_LANGUAGE_VERSION));
Log.Write("graphics", "Available extensions:");
Log.Write("graphics", OpenGL.glGetString(OpenGL.GL_EXTENSIONS));
}
}
}

View File

@@ -57,7 +57,7 @@ namespace OpenRA.Platforms.Default
if (status != OpenGL.FRAMEBUFFER_COMPLETE_EXT)
{
var error = "Error creating framebuffer: {0}\n{1}".F(status, new StackTrace());
ErrorHandler.WriteGraphicsLog(error);
OpenGL.WriteGraphicsLog(error);
throw new InvalidOperationException("OpenGL Error: See graphics.log for details.");
}

View File

@@ -409,5 +409,27 @@ namespace OpenRA.Platforms.Default
{
return (T)(object)Marshal.GetDelegateForFunctionPointer(SDL.SDL_GL_GetProcAddress(name), typeof(T));
}
public static void WriteGraphicsLog(string message)
{
Log.Write("graphics", message);
Log.Write("graphics", "");
Log.Write("graphics", "OpenGL Information:");
var vendor = OpenGL.glGetString(OpenGL.GL_VENDOR);
Log.Write("graphics", "Vendor: {0}", vendor);
if (vendor.Contains("Microsoft"))
{
var msg = "";
msg += "Note: The default driver provided by Microsoft does not include full OpenGL support.\n";
msg += "Please install the latest drivers from your graphics card manufacturer's website.\n";
Log.Write("graphics", msg);
}
Log.Write("graphics", "Renderer: {0}", OpenGL.glGetString(OpenGL.GL_RENDERER));
Log.Write("graphics", "GL Version: {0}", OpenGL.glGetString(OpenGL.GL_VERSION));
Log.Write("graphics", "Shader Version: {0}", OpenGL.glGetString(OpenGL.GL_SHADING_LANGUAGE_VERSION));
Log.Write("graphics", "Available extensions:");
Log.Write("graphics", OpenGL.glGetString(OpenGL.GL_EXTENSIONS));
}
}
}

View File

@@ -82,7 +82,7 @@ namespace OpenRA.Platforms.Default
if (SDL.SDL_GL_ExtensionSupported("GL_EXT_framebuffer_object") == SDL.SDL_bool.SDL_FALSE)
{
ErrorHandler.WriteGraphicsLog("OpenRA requires the OpenGL extension GL_EXT_framebuffer_object.\n"
OpenGL.WriteGraphicsLog("OpenRA requires the OpenGL extension GL_EXT_framebuffer_object.\n"
+ "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.");
}