[colobot] 148/377: Added warnings and error messages to graphics devices regarding unsupported OpenGL version
Didier Raboud
odyx at moszumanska.debian.org
Wed Mar 30 13:34:09 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 aa2e14219e698b5da543826e21227b11d138ab34
Author: Tomasz Kapuściński <tomaszkax86 at gmail.com>
Date: Fri Dec 18 21:04:16 2015 +0100
Added warnings and error messages to graphics devices regarding unsupported OpenGL version
---
src/app/app.cpp | 5 ++++-
src/graphics/core/device.h | 9 +++++++++
src/graphics/opengl/gl21device.cpp | 7 ++++++-
src/graphics/opengl/gl33device.cpp | 11 +++++++++--
src/graphics/opengl/gldevice.cpp | 14 +++++++++++++-
5 files changed, 41 insertions(+), 5 deletions(-)
diff --git a/src/app/app.cpp b/src/app/app.cpp
index 5c12408..0a82f32 100644
--- a/src/app/app.cpp
+++ b/src/app/app.cpp
@@ -624,7 +624,10 @@ bool CApplication::Create()
if (! m_device->Create() )
{
- m_errorMessage = std::string("Error in CDevice::Create()\n") + standardInfoMessage;
+ m_errorMessage = std::string("Error in CDevice::Create()\n")
+ + "\n\n"
+ + m_device->GetError()
+ + standardInfoMessage;
m_exitCode = 5;
return false;
}
diff --git a/src/graphics/core/device.h b/src/graphics/core/device.h
index 36ba958..def5b7f 100644
--- a/src/graphics/core/device.h
+++ b/src/graphics/core/device.h
@@ -276,9 +276,18 @@ public:
*/
class CDevice
{
+protected:
+ std::string m_errorMessage;
+
public:
virtual ~CDevice() {}
+ //! Returns last error message or empty string
+ inline std::string GetError()
+ {
+ return m_errorMessage;
+ }
+
//! Provides a hook to debug graphics code (implementation-specific)
virtual void DebugHook() = 0;
diff --git a/src/graphics/opengl/gl21device.cpp b/src/graphics/opengl/gl21device.cpp
index 1a86fad..bd8f272 100644
--- a/src/graphics/opengl/gl21device.cpp
+++ b/src/graphics/opengl/gl21device.cpp
@@ -177,6 +177,7 @@ bool CGL21Device::Create()
if (glewInit() != GLEW_OK)
{
GetLogger()->Error("GLEW initialization failed\n");
+ m_errorMessage = "An error occured while initializing GLEW.";
return false;
}
@@ -186,7 +187,11 @@ bool CGL21Device::Create()
if (m_glMajor < 2)
{
- GetLogger()->Error("Your hardware does not support OpenGL 2.0 or 2.1.");
+ GetLogger()->Error("Unsupported OpenGL version: %d.%d\n", m_glMajor, m_glMinor);
+ 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)";
return false;
}
diff --git a/src/graphics/opengl/gl33device.cpp b/src/graphics/opengl/gl33device.cpp
index 1246564..1560cc8 100644
--- a/src/graphics/opengl/gl33device.cpp
+++ b/src/graphics/opengl/gl33device.cpp
@@ -177,6 +177,7 @@ bool CGL33Device::Create()
if (glewInit() != GLEW_OK)
{
GetLogger()->Error("GLEW initialization failed\n");
+ m_errorMessage = "An error occured while initializing GLEW.";
return false;
}
@@ -187,12 +188,18 @@ bool CGL33Device::Create()
int glVersion = 10 * m_glMajor + m_glMinor;
if (glVersion < 30)
{
- GetLogger()->Error("Your hardware does not support OpenGL 3.0+. Exiting.\n");
+ GetLogger()->Error("Unsupported OpenGL version: %d.%d\n", m_glMajor, m_glMinor);
+ 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)";
return false;
}
else if (glVersion < 33)
{
- GetLogger()->Warn("Full OpenGL 3.3 unavailable. Graphics might be bugged.\n");
+ GetLogger()->Warn("Partially supported OpenGL version: %d.%d\n", m_glMajor, m_glMinor);
+ GetLogger()->Warn("You may experience problems while running the game on this engine.\n");
+ GetLogger()->Warn("OpenGL 3.3 or newer is recommended.\n");
}
else
{
diff --git a/src/graphics/opengl/gldevice.cpp b/src/graphics/opengl/gldevice.cpp
index 6070acd..4eba81a 100644
--- a/src/graphics/opengl/gldevice.cpp
+++ b/src/graphics/opengl/gldevice.cpp
@@ -173,12 +173,24 @@ bool CGLDevice::Create()
if (glewInit() != GLEW_OK)
{
GetLogger()->Error("GLEW initialization failed\n");
+ m_errorMessage = "An error occured while initializing GLEW.";
return false;
}
// Extract OpenGL version
const char *version = reinterpret_cast<const char*>(glGetString(GL_VERSION));
sscanf(version, "%d.%d", &m_glMajor, &m_glMinor);
+
+ int glVersion = 10 * m_glMajor + m_glMinor;
+ if (glVersion < 13)
+ {
+ 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";
+ return false;
+ }
+
GetLogger()->Info("OpenGL %d.%d\n", m_glMajor, m_glMinor);
// Detect multitexture support
@@ -306,7 +318,7 @@ bool CGLDevice::Create()
m_framebufferSupport = DetectFramebufferSupport();
if (m_framebufferSupport != FBS_NONE)
- GetLogger()->Debug("Framebuffer supported\n");
+ GetLogger()->Info("Framebuffer supported\n");
GetLogger()->Info("CDevice created successfully\n");
--
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