2010-09-07 17:34:51 +02:00
|
|
|
//========================================================================
|
2015-01-26 03:16:43 +01:00
|
|
|
// Context creation and information tool
|
2010-09-07 17:34:51 +02:00
|
|
|
// Copyright (c) Camilla Berglund <elmindreda@elmindreda.org>
|
|
|
|
//
|
|
|
|
// This software is provided 'as-is', without any express or implied
|
|
|
|
// warranty. In no event will the authors be held liable for any damages
|
|
|
|
// arising from the use of this software.
|
|
|
|
//
|
|
|
|
// Permission is granted to anyone to use this software for any purpose,
|
|
|
|
// including commercial applications, and to alter it and redistribute it
|
|
|
|
// freely, subject to the following restrictions:
|
|
|
|
//
|
|
|
|
// 1. The origin of this software must not be misrepresented; you must not
|
|
|
|
// claim that you wrote the original software. If you use this software
|
|
|
|
// in a product, an acknowledgment in the product documentation would
|
|
|
|
// be appreciated but is not required.
|
|
|
|
//
|
|
|
|
// 2. Altered source versions must be plainly marked as such, and must not
|
|
|
|
// be misrepresented as being the original software.
|
|
|
|
//
|
|
|
|
// 3. This notice may not be removed or altered from any source
|
|
|
|
// distribution.
|
|
|
|
//
|
|
|
|
//========================================================================
|
|
|
|
|
2013-05-22 22:46:34 +02:00
|
|
|
#include <GLFW/glfw3.h>
|
2014-10-22 13:49:16 +02:00
|
|
|
#include <GL/glext.h>
|
2010-09-07 17:34:51 +02:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "getopt.h"
|
|
|
|
|
2011-10-09 00:55:39 +02:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
#define strcasecmp(x, y) _stricmp(x, y)
|
|
|
|
#endif
|
|
|
|
|
2015-01-26 03:16:43 +01:00
|
|
|
#define API_NAME_OPENGL "gl"
|
|
|
|
#define API_NAME_OPENGL_ES "es"
|
2012-09-30 15:32:50 +02:00
|
|
|
|
2011-10-09 00:55:39 +02:00
|
|
|
#define PROFILE_NAME_CORE "core"
|
|
|
|
#define PROFILE_NAME_COMPAT "compat"
|
|
|
|
|
2014-08-21 19:21:45 +02:00
|
|
|
#define STRATEGY_NAME_NONE "none"
|
|
|
|
#define STRATEGY_NAME_LOSE "lose"
|
|
|
|
|
|
|
|
#define BEHAVIOR_NAME_NONE "none"
|
|
|
|
#define BEHAVIOR_NAME_FLUSH "flush"
|
2011-10-09 00:55:39 +02:00
|
|
|
|
2010-09-07 17:34:51 +02:00
|
|
|
static void usage(void)
|
|
|
|
{
|
2015-01-26 03:16:43 +01:00
|
|
|
printf("Usage: glfwinfo [OPTION]...\n");
|
2013-11-03 13:38:45 +01:00
|
|
|
printf("Options:\n");
|
2015-01-26 03:16:43 +01:00
|
|
|
printf(" -a, --client-api=API the client API to use ("
|
|
|
|
API_NAME_OPENGL " or "
|
|
|
|
API_NAME_OPENGL_ES ")\n");
|
|
|
|
printf(" -b, --behavior=BEHAVIOR the release behavior to use ("
|
|
|
|
BEHAVIOR_NAME_NONE " or "
|
|
|
|
BEHAVIOR_NAME_FLUSH ")\n");
|
|
|
|
printf(" -d, --debug request a debug context\n");
|
|
|
|
printf(" -f, --forward require a forward-compatible context\n");
|
|
|
|
printf(" -h, --help show this help\n");
|
|
|
|
printf(" -l, --list-extensions list all client API extensions\n");
|
|
|
|
printf(" -m, --major=MAJOR the major number of the required "
|
|
|
|
"client API version\n");
|
|
|
|
printf(" -n, --minor=MINOR the minor number of the required "
|
|
|
|
"client API version\n");
|
|
|
|
printf(" -p, --profile=PROFILE the OpenGL profile to use ("
|
|
|
|
PROFILE_NAME_CORE " or "
|
|
|
|
PROFILE_NAME_COMPAT ")\n");
|
|
|
|
printf(" -s, --robustness=STRATEGY the robustness strategy to use ("
|
|
|
|
STRATEGY_NAME_NONE " or "
|
|
|
|
STRATEGY_NAME_LOSE ")\n");
|
2010-09-07 17:34:51 +02:00
|
|
|
}
|
|
|
|
|
2010-11-23 17:45:23 +01:00
|
|
|
static void error_callback(int error, const char* description)
|
|
|
|
{
|
2012-09-30 15:51:46 +02:00
|
|
|
fprintf(stderr, "Error: %s\n", description);
|
2010-11-23 17:45:23 +01:00
|
|
|
}
|
|
|
|
|
2015-01-26 03:16:43 +01:00
|
|
|
static const char* get_api_name(int api)
|
2010-10-03 18:55:13 +02:00
|
|
|
{
|
2012-09-30 15:32:50 +02:00
|
|
|
if (api == GLFW_OPENGL_API)
|
|
|
|
return "OpenGL";
|
|
|
|
else if (api == GLFW_OPENGL_ES_API)
|
|
|
|
return "OpenGL ES";
|
2010-10-03 18:55:13 +02:00
|
|
|
|
2012-09-30 15:32:50 +02:00
|
|
|
return "Unknown API";
|
2010-10-03 18:55:13 +02:00
|
|
|
}
|
|
|
|
|
2012-10-21 22:13:14 +02:00
|
|
|
static const char* get_profile_name_gl(GLint mask)
|
2010-09-07 17:34:51 +02:00
|
|
|
{
|
2010-09-11 14:33:24 +02:00
|
|
|
if (mask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
|
2012-12-13 20:04:17 +01:00
|
|
|
return PROFILE_NAME_COMPAT;
|
2010-09-11 14:33:24 +02:00
|
|
|
if (mask & GL_CONTEXT_CORE_PROFILE_BIT)
|
2012-12-13 20:04:17 +01:00
|
|
|
return PROFILE_NAME_CORE;
|
2010-09-07 17:34:51 +02:00
|
|
|
|
2010-10-03 18:55:13 +02:00
|
|
|
return "unknown";
|
2010-09-07 17:34:51 +02:00
|
|
|
}
|
|
|
|
|
2012-10-21 22:13:14 +02:00
|
|
|
static const char* get_profile_name_glfw(int profile)
|
|
|
|
{
|
|
|
|
if (profile == GLFW_OPENGL_COMPAT_PROFILE)
|
2012-12-13 20:04:17 +01:00
|
|
|
return PROFILE_NAME_COMPAT;
|
2012-10-21 22:13:14 +02:00
|
|
|
if (profile == GLFW_OPENGL_CORE_PROFILE)
|
2012-12-13 20:04:17 +01:00
|
|
|
return PROFILE_NAME_CORE;
|
2012-10-21 22:13:14 +02:00
|
|
|
|
|
|
|
return "unknown";
|
|
|
|
}
|
|
|
|
|
2012-12-13 19:29:18 +01:00
|
|
|
static const char* get_strategy_name_gl(GLint strategy)
|
|
|
|
{
|
|
|
|
if (strategy == GL_LOSE_CONTEXT_ON_RESET_ARB)
|
|
|
|
return STRATEGY_NAME_LOSE;
|
|
|
|
if (strategy == GL_NO_RESET_NOTIFICATION_ARB)
|
|
|
|
return STRATEGY_NAME_NONE;
|
|
|
|
|
|
|
|
return "unknown";
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char* get_strategy_name_glfw(int strategy)
|
|
|
|
{
|
|
|
|
if (strategy == GLFW_LOSE_CONTEXT_ON_RESET)
|
|
|
|
return STRATEGY_NAME_LOSE;
|
|
|
|
if (strategy == GLFW_NO_RESET_NOTIFICATION)
|
|
|
|
return STRATEGY_NAME_NONE;
|
2012-10-21 22:13:14 +02:00
|
|
|
|
|
|
|
return "unknown";
|
|
|
|
}
|
|
|
|
|
2012-09-30 15:32:50 +02:00
|
|
|
static void list_extensions(int api, int major, int minor)
|
2010-09-07 17:34:51 +02:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
GLint count;
|
|
|
|
const GLubyte* extensions;
|
|
|
|
|
2015-01-26 03:16:43 +01:00
|
|
|
printf("%s context supported extensions:\n", get_api_name(api));
|
2010-09-07 17:34:51 +02:00
|
|
|
|
2012-09-30 15:32:50 +02:00
|
|
|
if (api == GLFW_OPENGL_API && major > 2)
|
2010-09-07 17:34:51 +02:00
|
|
|
{
|
2015-01-26 03:16:43 +01:00
|
|
|
PFNGLGETSTRINGIPROC glGetStringi =
|
|
|
|
(PFNGLGETSTRINGIPROC) glfwGetProcAddress("glGetStringi");
|
2010-09-07 17:34:51 +02:00
|
|
|
if (!glGetStringi)
|
2012-10-22 03:20:16 +02:00
|
|
|
{
|
|
|
|
glfwTerminate();
|
2010-09-07 17:34:51 +02:00
|
|
|
exit(EXIT_FAILURE);
|
2012-10-22 03:20:16 +02:00
|
|
|
}
|
2010-09-07 17:34:51 +02:00
|
|
|
|
|
|
|
glGetIntegerv(GL_NUM_EXTENSIONS, &count);
|
|
|
|
|
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
puts((const char*) glGetStringi(GL_EXTENSIONS, i));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
extensions = glGetString(GL_EXTENSIONS);
|
|
|
|
while (*extensions != '\0')
|
|
|
|
{
|
|
|
|
if (*extensions == ' ')
|
|
|
|
putchar('\n');
|
|
|
|
else
|
|
|
|
putchar(*extensions);
|
|
|
|
|
|
|
|
extensions++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
putchar('\n');
|
|
|
|
}
|
|
|
|
|
2012-08-30 02:17:08 +02:00
|
|
|
static GLboolean valid_version(void)
|
|
|
|
{
|
|
|
|
int major, minor, revision;
|
|
|
|
|
|
|
|
glfwGetVersion(&major, &minor, &revision);
|
|
|
|
|
|
|
|
printf("GLFW header version: %u.%u.%u\n",
|
|
|
|
GLFW_VERSION_MAJOR,
|
|
|
|
GLFW_VERSION_MINOR,
|
|
|
|
GLFW_VERSION_REVISION);
|
|
|
|
|
|
|
|
printf("GLFW library version: %u.%u.%u\n", major, minor, revision);
|
|
|
|
|
|
|
|
if (major != GLFW_VERSION_MAJOR)
|
|
|
|
{
|
|
|
|
printf("*** ERROR: GLFW major version mismatch! ***\n");
|
|
|
|
return GL_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (minor != GLFW_VERSION_MINOR || revision != GLFW_VERSION_REVISION)
|
|
|
|
printf("*** WARNING: GLFW version mismatch! ***\n");
|
|
|
|
|
|
|
|
printf("GLFW library version string: \"%s\"\n", glfwGetVersionString());
|
|
|
|
return GL_TRUE;
|
|
|
|
}
|
|
|
|
|
2010-09-07 17:34:51 +02:00
|
|
|
int main(int argc, char** argv)
|
|
|
|
{
|
2015-01-26 03:16:43 +01:00
|
|
|
int ch, profile = 0, strategy = 0, behavior = 0;
|
|
|
|
int api = 0, major = 1, minor = 0, revision;
|
2010-09-07 17:34:51 +02:00
|
|
|
GLboolean debug = GL_FALSE, forward = GL_FALSE, list = GL_FALSE;
|
|
|
|
GLint flags, mask;
|
2013-01-05 21:13:28 +01:00
|
|
|
GLFWwindow* window;
|
2010-09-07 17:34:51 +02:00
|
|
|
|
2015-01-26 03:16:43 +01:00
|
|
|
enum { API, BEHAVIOR, DEBUG, FORWARD, HELP, EXTENSIONS,
|
|
|
|
MAJOR, MINOR, PROFILE, ROBUSTNESS };
|
|
|
|
const struct option options[] =
|
|
|
|
{
|
|
|
|
{ "behavior", 1, NULL, BEHAVIOR },
|
|
|
|
{ "client-api", 1, NULL, API },
|
|
|
|
{ "debug", 0, NULL, DEBUG },
|
|
|
|
{ "forward", 0, NULL, FORWARD },
|
|
|
|
{ "help", 0, NULL, HELP },
|
|
|
|
{ "list-extensions", 0, NULL, EXTENSIONS },
|
|
|
|
{ "major", 1, NULL, MAJOR },
|
|
|
|
{ "minor", 1, NULL, MINOR },
|
|
|
|
{ "profile", 1, NULL, PROFILE },
|
|
|
|
{ "robustness", 1, NULL, ROBUSTNESS },
|
|
|
|
{ NULL, 0, NULL, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
while ((ch = getopt_long(argc, argv, "a:b:dfhlm:n:p:s:", options, NULL)) != -1)
|
2010-09-07 17:34:51 +02:00
|
|
|
{
|
|
|
|
switch (ch)
|
|
|
|
{
|
2012-09-30 15:32:50 +02:00
|
|
|
case 'a':
|
2015-01-26 03:16:43 +01:00
|
|
|
case API:
|
|
|
|
if (strcasecmp(optarg, API_NAME_OPENGL) == 0)
|
2012-09-30 15:32:50 +02:00
|
|
|
api = GLFW_OPENGL_API;
|
2015-01-26 03:16:43 +01:00
|
|
|
else if (strcasecmp(optarg, API_NAME_OPENGL_ES) == 0)
|
2012-09-30 15:32:50 +02:00
|
|
|
api = GLFW_OPENGL_ES_API;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
usage();
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
2014-08-20 17:59:58 +02:00
|
|
|
break;
|
2014-08-21 19:21:45 +02:00
|
|
|
case 'b':
|
2015-01-26 03:16:43 +01:00
|
|
|
case BEHAVIOR:
|
2014-08-21 19:21:45 +02:00
|
|
|
if (strcasecmp(optarg, BEHAVIOR_NAME_NONE) == 0)
|
|
|
|
behavior = GLFW_RELEASE_BEHAVIOR_NONE;
|
|
|
|
else if (strcasecmp(optarg, BEHAVIOR_NAME_FLUSH) == 0)
|
|
|
|
behavior = GLFW_RELEASE_BEHAVIOR_FLUSH;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
usage();
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
break;
|
2010-09-07 17:34:51 +02:00
|
|
|
case 'd':
|
2015-01-26 03:16:43 +01:00
|
|
|
case DEBUG:
|
2010-09-07 17:34:51 +02:00
|
|
|
debug = GL_TRUE;
|
|
|
|
break;
|
|
|
|
case 'f':
|
2015-01-26 03:16:43 +01:00
|
|
|
case FORWARD:
|
2010-09-07 17:34:51 +02:00
|
|
|
forward = GL_TRUE;
|
|
|
|
break;
|
|
|
|
case 'h':
|
2015-01-26 03:16:43 +01:00
|
|
|
case HELP:
|
2010-09-07 17:34:51 +02:00
|
|
|
usage();
|
2010-09-20 20:22:26 +02:00
|
|
|
exit(EXIT_SUCCESS);
|
2010-09-07 17:34:51 +02:00
|
|
|
case 'l':
|
2015-01-26 03:16:43 +01:00
|
|
|
case EXTENSIONS:
|
2010-09-07 17:34:51 +02:00
|
|
|
list = GL_TRUE;
|
|
|
|
break;
|
|
|
|
case 'm':
|
2015-01-26 03:16:43 +01:00
|
|
|
case MAJOR:
|
2010-09-07 17:34:51 +02:00
|
|
|
major = atoi(optarg);
|
|
|
|
break;
|
|
|
|
case 'n':
|
2015-01-26 03:16:43 +01:00
|
|
|
case MINOR:
|
2010-09-07 17:34:51 +02:00
|
|
|
minor = atoi(optarg);
|
|
|
|
break;
|
|
|
|
case 'p':
|
2015-01-26 03:16:43 +01:00
|
|
|
case PROFILE:
|
2011-10-09 00:55:39 +02:00
|
|
|
if (strcasecmp(optarg, PROFILE_NAME_CORE) == 0)
|
2010-09-07 17:34:51 +02:00
|
|
|
profile = GLFW_OPENGL_CORE_PROFILE;
|
2011-10-09 00:55:39 +02:00
|
|
|
else if (strcasecmp(optarg, PROFILE_NAME_COMPAT) == 0)
|
2010-09-07 17:34:51 +02:00
|
|
|
profile = GLFW_OPENGL_COMPAT_PROFILE;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
usage();
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
break;
|
2014-08-21 19:21:45 +02:00
|
|
|
case 's':
|
2015-01-26 03:16:43 +01:00
|
|
|
case ROBUSTNESS:
|
2011-10-09 00:55:39 +02:00
|
|
|
if (strcasecmp(optarg, STRATEGY_NAME_NONE) == 0)
|
2012-12-13 02:22:39 +01:00
|
|
|
strategy = GLFW_NO_RESET_NOTIFICATION;
|
2011-10-09 00:55:39 +02:00
|
|
|
else if (strcasecmp(optarg, STRATEGY_NAME_LOSE) == 0)
|
2012-12-13 02:22:39 +01:00
|
|
|
strategy = GLFW_LOSE_CONTEXT_ON_RESET;
|
2011-03-07 20:51:34 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
usage();
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
break;
|
2010-09-07 17:34:51 +02:00
|
|
|
default:
|
|
|
|
usage();
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-28 22:56:35 +02:00
|
|
|
// Initialize GLFW and create window
|
|
|
|
|
2013-11-03 13:29:21 +01:00
|
|
|
if (!valid_version())
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
2011-09-16 01:16:31 +02:00
|
|
|
glfwSetErrorCallback(error_callback);
|
|
|
|
|
2012-02-07 14:58:58 +01:00
|
|
|
if (!glfwInit())
|
2010-09-07 17:34:51 +02:00
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
2010-09-11 15:13:23 +02:00
|
|
|
if (major != 1 || minor != 0)
|
2010-09-07 17:34:51 +02:00
|
|
|
{
|
2012-12-13 02:22:39 +01:00
|
|
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, major);
|
|
|
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, minor);
|
2010-09-07 17:34:51 +02:00
|
|
|
}
|
|
|
|
|
2015-01-26 03:16:43 +01:00
|
|
|
if (api)
|
2012-09-30 15:32:50 +02:00
|
|
|
glfwWindowHint(GLFW_CLIENT_API, api);
|
2010-09-07 17:34:51 +02:00
|
|
|
if (debug)
|
2012-08-06 17:56:41 +02:00
|
|
|
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE);
|
2010-09-07 17:34:51 +02:00
|
|
|
if (forward)
|
2012-08-06 17:56:41 +02:00
|
|
|
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
2015-01-26 03:16:43 +01:00
|
|
|
if (profile)
|
2012-08-06 17:56:41 +02:00
|
|
|
glfwWindowHint(GLFW_OPENGL_PROFILE, profile);
|
2011-03-07 20:51:34 +01:00
|
|
|
if (strategy)
|
2012-12-13 02:22:39 +01:00
|
|
|
glfwWindowHint(GLFW_CONTEXT_ROBUSTNESS, strategy);
|
2014-08-21 19:21:45 +02:00
|
|
|
if (behavior)
|
|
|
|
glfwWindowHint(GLFW_CONTEXT_RELEASE_BEHAVIOR, behavior);
|
|
|
|
|
2012-08-28 17:52:22 +02:00
|
|
|
glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
|
|
|
|
|
2012-11-27 16:55:04 +01:00
|
|
|
window = glfwCreateWindow(200, 200, "Version", NULL, NULL);
|
2010-10-03 18:55:13 +02:00
|
|
|
if (!window)
|
2012-10-22 03:20:16 +02:00
|
|
|
{
|
|
|
|
glfwTerminate();
|
2010-09-07 17:34:51 +02:00
|
|
|
exit(EXIT_FAILURE);
|
2012-10-22 03:20:16 +02:00
|
|
|
}
|
2010-09-07 17:34:51 +02:00
|
|
|
|
2012-08-10 15:29:45 +02:00
|
|
|
glfwMakeContextCurrent(window);
|
|
|
|
|
2012-09-30 15:32:50 +02:00
|
|
|
// Report client API version
|
2010-09-07 17:34:51 +02:00
|
|
|
|
2013-05-27 15:30:32 +02:00
|
|
|
api = glfwGetWindowAttrib(window, GLFW_CLIENT_API);
|
|
|
|
major = glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MAJOR);
|
|
|
|
minor = glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MINOR);
|
|
|
|
revision = glfwGetWindowAttrib(window, GLFW_CONTEXT_REVISION);
|
2010-09-07 17:34:51 +02:00
|
|
|
|
2012-09-30 15:32:50 +02:00
|
|
|
printf("%s context version string: \"%s\"\n",
|
2015-01-26 03:16:43 +01:00
|
|
|
get_api_name(api),
|
2012-09-30 15:32:50 +02:00
|
|
|
glGetString(GL_VERSION));
|
2010-09-07 17:34:51 +02:00
|
|
|
|
2012-09-30 15:32:50 +02:00
|
|
|
printf("%s context version parsed by GLFW: %u.%u.%u\n",
|
2015-01-26 03:16:43 +01:00
|
|
|
get_api_name(api),
|
2012-09-30 15:32:50 +02:00
|
|
|
major, minor, revision);
|
2010-09-07 17:34:51 +02:00
|
|
|
|
2012-09-30 15:32:50 +02:00
|
|
|
// Report client API context properties
|
2010-09-07 17:34:51 +02:00
|
|
|
|
2012-09-30 15:32:50 +02:00
|
|
|
if (api == GLFW_OPENGL_API)
|
2010-09-07 17:34:51 +02:00
|
|
|
{
|
2012-09-30 15:32:50 +02:00
|
|
|
if (major >= 3)
|
|
|
|
{
|
|
|
|
glGetIntegerv(GL_CONTEXT_FLAGS, &flags);
|
2015-01-26 03:16:43 +01:00
|
|
|
printf("%s context flags (0x%08x):", get_api_name(api), flags);
|
2012-09-30 15:32:50 +02:00
|
|
|
|
|
|
|
if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)
|
|
|
|
printf(" forward-compatible");
|
2012-12-13 17:33:08 +01:00
|
|
|
if (flags & GL_CONTEXT_FLAG_DEBUG_BIT)
|
2012-09-30 15:32:50 +02:00
|
|
|
printf(" debug");
|
2012-12-13 19:29:18 +01:00
|
|
|
if (flags & GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB)
|
|
|
|
printf(" robustness");
|
2012-09-30 15:32:50 +02:00
|
|
|
putchar('\n');
|
|
|
|
|
2015-01-26 03:16:43 +01:00
|
|
|
printf("%s context flags parsed by GLFW:", get_api_name(api));
|
2012-09-30 15:32:50 +02:00
|
|
|
|
2013-05-27 15:30:32 +02:00
|
|
|
if (glfwGetWindowAttrib(window, GLFW_OPENGL_FORWARD_COMPAT))
|
2012-09-30 15:32:50 +02:00
|
|
|
printf(" forward-compatible");
|
2013-05-27 15:30:32 +02:00
|
|
|
if (glfwGetWindowAttrib(window, GLFW_OPENGL_DEBUG_CONTEXT))
|
2012-09-30 15:32:50 +02:00
|
|
|
printf(" debug");
|
2015-01-26 03:16:43 +01:00
|
|
|
if (glfwGetWindowAttrib(window, GLFW_CONTEXT_ROBUSTNESS) == GLFW_LOSE_CONTEXT_ON_RESET)
|
2012-12-13 19:29:18 +01:00
|
|
|
printf(" robustness");
|
2012-09-30 15:32:50 +02:00
|
|
|
putchar('\n');
|
|
|
|
}
|
2010-10-03 18:55:13 +02:00
|
|
|
|
2015-01-26 03:16:43 +01:00
|
|
|
if (major >= 4 || (major == 3 && minor >= 2))
|
2012-09-30 15:32:50 +02:00
|
|
|
{
|
2013-05-27 15:30:32 +02:00
|
|
|
int profile = glfwGetWindowAttrib(window, GLFW_OPENGL_PROFILE);
|
2012-10-21 22:13:14 +02:00
|
|
|
|
2012-09-30 15:32:50 +02:00
|
|
|
glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask);
|
|
|
|
printf("%s profile mask (0x%08x): %s\n",
|
2015-01-26 03:16:43 +01:00
|
|
|
get_api_name(api),
|
2012-09-30 15:32:50 +02:00
|
|
|
mask,
|
2012-10-21 22:13:14 +02:00
|
|
|
get_profile_name_gl(mask));
|
2012-09-30 15:32:50 +02:00
|
|
|
|
2012-10-21 22:13:14 +02:00
|
|
|
printf("%s profile mask parsed by GLFW: %s\n",
|
2015-01-26 03:16:43 +01:00
|
|
|
get_api_name(api),
|
2012-10-21 22:13:14 +02:00
|
|
|
get_profile_name_glfw(profile));
|
2012-09-30 15:32:50 +02:00
|
|
|
}
|
2012-12-13 19:29:18 +01:00
|
|
|
|
|
|
|
if (glfwExtensionSupported("GL_ARB_robustness"))
|
|
|
|
{
|
|
|
|
int robustness;
|
|
|
|
GLint strategy;
|
|
|
|
glGetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, &strategy);
|
|
|
|
|
|
|
|
printf("%s robustness strategy (0x%08x): %s\n",
|
2015-01-26 03:16:43 +01:00
|
|
|
get_api_name(api),
|
2012-12-13 19:29:18 +01:00
|
|
|
strategy,
|
|
|
|
get_strategy_name_gl(strategy));
|
|
|
|
|
2013-05-27 15:30:32 +02:00
|
|
|
robustness = glfwGetWindowAttrib(window, GLFW_CONTEXT_ROBUSTNESS);
|
2012-12-13 19:29:18 +01:00
|
|
|
|
|
|
|
printf("%s robustness strategy parsed by GLFW: %s\n",
|
2015-01-26 03:16:43 +01:00
|
|
|
get_api_name(api),
|
2012-12-13 19:29:18 +01:00
|
|
|
get_strategy_name_glfw(robustness));
|
|
|
|
}
|
2010-09-07 17:34:51 +02:00
|
|
|
}
|
|
|
|
|
2012-09-30 15:32:50 +02:00
|
|
|
printf("%s context renderer string: \"%s\"\n",
|
2015-01-26 03:16:43 +01:00
|
|
|
get_api_name(api),
|
2012-09-30 15:32:50 +02:00
|
|
|
glGetString(GL_RENDERER));
|
|
|
|
printf("%s context vendor string: \"%s\"\n",
|
2015-01-26 03:16:43 +01:00
|
|
|
get_api_name(api),
|
2012-09-30 15:32:50 +02:00
|
|
|
glGetString(GL_VENDOR));
|
|
|
|
|
2015-01-26 03:16:43 +01:00
|
|
|
if (major >= 2)
|
2010-09-07 17:34:51 +02:00
|
|
|
{
|
2012-09-30 15:32:50 +02:00
|
|
|
printf("%s context shading language version: \"%s\"\n",
|
2015-01-26 03:16:43 +01:00
|
|
|
get_api_name(api),
|
2011-10-09 00:55:39 +02:00
|
|
|
glGetString(GL_SHADING_LANGUAGE_VERSION));
|
2010-09-07 17:34:51 +02:00
|
|
|
}
|
|
|
|
|
2012-09-30 15:32:50 +02:00
|
|
|
// Report client API extensions
|
2010-09-07 17:34:51 +02:00
|
|
|
if (list)
|
2012-09-30 15:32:50 +02:00
|
|
|
list_extensions(api, major, minor);
|
2010-09-07 17:34:51 +02:00
|
|
|
|
|
|
|
glfwTerminate();
|
|
|
|
exit(EXIT_SUCCESS);
|
|
|
|
}
|
|
|
|
|