[colobot] 161/377: Added information about graphics card to error message
Didier Raboud
odyx at moszumanska.debian.org
Wed Mar 30 13:34:11 UTC 2016
This is an automated email from the git hooks/post-receive script.
odyx pushed a commit to branch debian/master
in repository colobot.
commit 22e963e2c4dbd4da840f643dd4c6971df5c3f1ce
Author: Tomasz Kapuściński <tomaszkax86 at gmail.com>
Date: Sun Dec 20 17:34:55 2015 +0100
Added information about graphics card to error message
---
src/graphics/opengl/gl21device.cpp | 3 ++-
src/graphics/opengl/gl33device.cpp | 3 ++-
src/graphics/opengl/gldevice.cpp | 3 ++-
src/graphics/opengl/glutil.cpp | 24 ++++++++++++++++++++++++
src/graphics/opengl/glutil.h | 4 ++++
5 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/src/graphics/opengl/gl21device.cpp b/src/graphics/opengl/gl21device.cpp
index bd8f272..6b4327a 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 1560cc8..8799013 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 4eba81a..5aeab5f 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 75f2a9f..41caf2e 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<const char*>(glGetString(GL_VERSION));
+ const char* vendor = reinterpret_cast<const char*>(glGetString(GL_VENDOR));
+ const char* renderer = reinterpret_cast<const char*>(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<const char*>(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 2b451c4..1c23140 100644
--- a/src/graphics/opengl/glutil.h
+++ b/src/graphics/opengl/glutil.h
@@ -30,6 +30,7 @@
#include <GL/glew.h>
+#include <string>
#include <memory>
@@ -53,6 +54,9 @@ std::unique_ptr<CDevice> 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);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git
More information about the Pkg-games-commits
mailing list