Fixed output of GLFW-parsed context profile by glfwinfo.

This commit is contained in:
Camilla Berglund 2012-10-21 22:13:14 +02:00
parent 467d501621
commit bf43247aed

View File

@ -74,7 +74,7 @@ static const char* get_client_api_name(int api)
return "Unknown API"; return "Unknown API";
} }
static const char* get_profile_name(GLint mask) static const char* get_profile_name_gl(GLint mask)
{ {
if (mask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) if (mask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
return "compatibility"; return "compatibility";
@ -84,6 +84,16 @@ static const char* get_profile_name(GLint mask)
return "unknown"; return "unknown";
} }
static const char* get_profile_name_glfw(int profile)
{
if (profile == GLFW_OPENGL_COMPAT_PROFILE)
return "compatibility";
if (profile == GLFW_OPENGL_CORE_PROFILE)
return "core";
return "unknown";
}
static void list_extensions(int api, int major, int minor) static void list_extensions(int api, int major, int minor)
{ {
int i; int i;
@ -302,13 +312,17 @@ int main(int argc, char** argv)
if (major > 3 || (major == 3 && minor >= 2)) if (major > 3 || (major == 3 && minor >= 2))
{ {
int profile = glfwGetWindowParam(window, GLFW_OPENGL_PROFILE);
glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask); glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask);
printf("%s profile mask (0x%08x): %s\n", printf("%s profile mask (0x%08x): %s\n",
get_client_api_name(api), get_client_api_name(api),
mask, mask,
get_profile_name(mask)); get_profile_name_gl(mask));
printf("%s profile mask parsed by GLFW:\n", get_client_api_name(api)); printf("%s profile mask parsed by GLFW: %s\n",
get_client_api_name(api),
get_profile_name_glfw(profile));
} }
} }