|
@@ -132,7 +132,7 @@ void Window::setGLContextAttributes(const ContextAttribs &attribs)
|
|
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, contextflags);
|
|
|
}
|
|
|
|
|
|
-bool Window::checkGLVersion(const ContextAttribs &attribs)
|
|
|
+bool Window::checkGLVersion(const ContextAttribs &attribs, std::string &outversion)
|
|
|
{
|
|
|
typedef unsigned char GLubyte;
|
|
|
typedef unsigned int GLenum;
|
|
@@ -149,6 +149,8 @@ bool Window::checkGLVersion(const ContextAttribs &attribs)
|
|
|
if (!glversion)
|
|
|
return false;
|
|
|
|
|
|
+ outversion = glversion;
|
|
|
+
|
|
|
int glmajor = 0;
|
|
|
int glminor = 0;
|
|
|
|
|
@@ -229,6 +231,7 @@ bool Window::createWindowAndContext(int x, int y, int w, int h, Uint32 windowfla
|
|
|
}
|
|
|
|
|
|
std::string windowerror;
|
|
|
+ std::string glversion;
|
|
|
|
|
|
// Try each context profile in order.
|
|
|
for (ContextAttribs attribs : attribslist)
|
|
@@ -320,7 +323,7 @@ bool Window::createWindowAndContext(int x, int y, int w, int h, Uint32 windowfla
|
|
|
}
|
|
|
|
|
|
// Make sure the context's version is at least what we requested.
|
|
|
- if (context && !checkGLVersion(attribs))
|
|
|
+ if (context && !checkGLVersion(attribs, glversion))
|
|
|
{
|
|
|
SDL_GL_DeleteContext(context);
|
|
|
context = nullptr;
|
|
@@ -354,6 +357,9 @@ bool Window::createWindowAndContext(int x, int y, int w, int h, Uint32 windowfla
|
|
|
std::string title = "Unable to initialize OpenGL";
|
|
|
std::string message = "This program requires a graphics card and video drivers which support OpenGL 2.1 or OpenGL ES 2.";
|
|
|
|
|
|
+ if (!glversion.empty())
|
|
|
+ message += " \n(Detected OpenGL version: " + glversion + ")";
|
|
|
+
|
|
|
std::cerr << title << std::endl << message << std::endl;
|
|
|
|
|
|
// Display a message box with the error, but only once.
|