diff --git a/src/graphics/opengl/gl21device.cpp b/src/graphics/opengl/gl21device.cpp index bd8f2726..6b4327ad 100644 --- a/src/graphics/opengl/gl21device.cpp +++ b/src/graphics/opengl/gl21device.cpp @@ -191,7 +191,8 @@ bool CGL21Device::Create() GetLogger()->Error("OpenGL 2.0 or newer is required to use this engine.\n"); m_errorMessage = "It seems your graphics card does not support OpenGL 2.0.\n"; m_errorMessage += "Please make sure you have appropriate hardware and newest drivers installed.\n"; - m_errorMessage += "(OpenGL 2.0 is roughly equivalent to Direct3D 9)"; + m_errorMessage += "(OpenGL 2.0 is roughly equivalent to Direct3D 9)\n\n"; + m_errorMessage += GetHardwareInfo(false); return false; } diff --git a/src/graphics/opengl/gl33device.cpp b/src/graphics/opengl/gl33device.cpp index 1560cc8c..8799013c 100644 --- a/src/graphics/opengl/gl33device.cpp +++ b/src/graphics/opengl/gl33device.cpp @@ -192,7 +192,8 @@ bool CGL33Device::Create() GetLogger()->Error("OpenGL 3.0 or newer is required to use this engine.\n"); m_errorMessage = "It seems your graphics card does not support OpenGL 3.0.\n"; m_errorMessage += "Please make sure you have appropriate hardware and newest drivers installed.\n"; - m_errorMessage += "(OpenGL 3.0 is roughly equivalent to Direct3D 10)"; + m_errorMessage += "(OpenGL 3.0 is roughly equivalent to Direct3D 10)\n\n"; + m_errorMessage += GetHardwareInfo(false); return false; } else if (glVersion < 33) diff --git a/src/graphics/opengl/gldevice.cpp b/src/graphics/opengl/gldevice.cpp index 4eba81a6..5aeab5f3 100644 --- a/src/graphics/opengl/gldevice.cpp +++ b/src/graphics/opengl/gldevice.cpp @@ -187,7 +187,8 @@ bool CGLDevice::Create() GetLogger()->Error("Unsupported OpenGL version: %d.%d\n", m_glMajor, m_glMinor); GetLogger()->Error("OpenGL 1.3 or newer is required to use this engine.\n"); m_errorMessage = "It seems your graphics card does not support OpenGL 1.3.\n"; - m_errorMessage += "Please make sure you have appropriate hardware and newest drivers installed.\n"; + m_errorMessage += "Please make sure you have appropriate hardware and newest drivers installed.\n\n"; + m_errorMessage += GetHardwareInfo(false); return false; } diff --git a/src/graphics/opengl/glutil.cpp b/src/graphics/opengl/glutil.cpp index 75f2a9ff..41caf2e6 100644 --- a/src/graphics/opengl/glutil.cpp +++ b/src/graphics/opengl/glutil.cpp @@ -73,6 +73,30 @@ int GetOpenGLVersion() return 10 * major + minor; } +std::string GetHardwareInfo(bool full) +{ + int glversion = GetOpenGLVersion(); + + const char* version = reinterpret_cast(glGetString(GL_VERSION)); + const char* vendor = reinterpret_cast(glGetString(GL_VENDOR)); + const char* renderer = reinterpret_cast(glGetString(GL_RENDERER)); + + std::string result; + + result += std::string("Hardware information:\n\n"); + result += "Version:\t" + std::string(version) + '\n'; + result += "Vendor:\t" + std::string(vendor) + '\n'; + result += "Renderer:\t" + std::string(renderer) + '\n'; + + if (glversion >= 20) + { + const char* glslVersion = reinterpret_cast(glGetString(GL_SHADING_LANGUAGE_VERSION)); + result += "Shading Language:\t" + std::string(glslVersion) + '\n'; + } + + return result; +} + GLenum TranslateGfxPrimitive(PrimitiveType type) { GLenum flag = 0; diff --git a/src/graphics/opengl/glutil.h b/src/graphics/opengl/glutil.h index 2b451c46..1c23140e 100644 --- a/src/graphics/opengl/glutil.h +++ b/src/graphics/opengl/glutil.h @@ -30,6 +30,7 @@ #include +#include #include @@ -53,6 +54,9 @@ std::unique_ptr CreateDevice(const DeviceConfig &config, const std::str // First digit is major part, second digit is minor part. int GetOpenGLVersion(); +//! Returns information about graphics card +std::string GetHardwareInfo(bool full); + //! Translate Gfx primitive type to OpenGL primitive type GLenum TranslateGfxPrimitive(PrimitiveType type);