#region usings
using System.Linq;
using OpenTK.Graphics.OpenGL4;
#endregion
namespace SM.OGL
{
///
/// Contains data and settings about the current OpenGL system.
///
public class GLSystem
{
private static bool _init;
///
/// Contains the device version of OpenGL.
///
public static Version DeviceVersion { get; private set; }
///
/// Contains the shader version for GLSL.
///
public static Version ShadingVersion { get; private set; }
///
/// Contains the extensions for OpenGL.
///
public static string[] Extensions { get; private set; }
///
/// Checks if proper Debugging is for this system available.
/// Determent, if the system has the "KHR_debug"-extension.
///
public static bool Debugging { get; private set; }
///
/// Initialize the system data.
/// Does nothing after the data was already collected.
///
public static void INIT_SYSTEM()
{
if (_init) return;
DeviceVersion = Version.CreateGLVersion(GL.GetString(StringName.Version));
ShadingVersion = Version.CreateGLVersion(GL.GetString(StringName.ShadingLanguageVersion));
Extensions = GL.GetString(StringName.Extensions).Split(' ');
Debugging = Extensions.Contains("khr_debug");
if (Debugging) GLDebugging.EnableDebugging();
_init = true;
}
}
}