|
|
@ -51,11 +51,15 @@ |
|
|
|
#define STRATEGY_NAME_NONE "none" |
|
|
|
#define STRATEGY_NAME_NONE "none" |
|
|
|
#define STRATEGY_NAME_LOSE "lose" |
|
|
|
#define STRATEGY_NAME_LOSE "lose" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define BEHAVIOR_NAME_NONE "none" |
|
|
|
|
|
|
|
#define BEHAVIOR_NAME_FLUSH "flush" |
|
|
|
|
|
|
|
|
|
|
|
static void usage(void) |
|
|
|
static void usage(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
printf("Usage: glfwinfo [-h] [-a API] [-m MAJOR] [-n MINOR] [-d] [-l] [-f] [-p PROFILE] [-r STRATEGY]\n"); |
|
|
|
printf("Usage: glfwinfo [-h] [-a API] [-m MAJOR] [-n MINOR] [-d] [-l] [-f] [-p PROFILE] [-s STRATEGY] [-b BEHAVIOR]\n"); |
|
|
|
printf("Options:\n"); |
|
|
|
printf("Options:\n"); |
|
|
|
printf(" -a the client API to use (" API_OPENGL " or " API_OPENGL_ES ")\n"); |
|
|
|
printf(" -a the client API to use (" API_OPENGL " or " API_OPENGL_ES ")\n"); |
|
|
|
|
|
|
|
printf(" -b the release behavior to use (" BEHAVIOR_NAME_NONE " or " BEHAVIOR_NAME_FLUSH ")\n"); |
|
|
|
printf(" -d request a debug context\n"); |
|
|
|
printf(" -d request a debug context\n"); |
|
|
|
printf(" -f require a forward-compatible context\n"); |
|
|
|
printf(" -f require a forward-compatible context\n"); |
|
|
|
printf(" -h show this help\n"); |
|
|
|
printf(" -h show this help\n"); |
|
|
@ -63,7 +67,7 @@ static void usage(void) |
|
|
|
printf(" -m the major number of the requred client API version\n"); |
|
|
|
printf(" -m the major number of the requred client API version\n"); |
|
|
|
printf(" -n the minor number of the requred client API version\n"); |
|
|
|
printf(" -n the minor number of the requred client API version\n"); |
|
|
|
printf(" -p the OpenGL profile to use (" PROFILE_NAME_CORE " or " PROFILE_NAME_COMPAT ")\n"); |
|
|
|
printf(" -p the OpenGL profile to use (" PROFILE_NAME_CORE " or " PROFILE_NAME_COMPAT ")\n"); |
|
|
|
printf(" -r the robustness strategy to use (" STRATEGY_NAME_NONE " or " STRATEGY_NAME_LOSE ")\n"); |
|
|
|
printf(" -s the robustness strategy to use (" STRATEGY_NAME_NONE " or " STRATEGY_NAME_LOSE ")\n"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void error_callback(int error, const char* description) |
|
|
|
static void error_callback(int error, const char* description) |
|
|
@ -188,12 +192,12 @@ static GLboolean valid_version(void) |
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char** argv) |
|
|
|
int main(int argc, char** argv) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int ch, api = 0, profile = 0, strategy = 0, major = 1, minor = 0, revision; |
|
|
|
int ch, api = 0, profile = 0, strategy = 0, behavior = 0, major = 1, minor = 0, revision; |
|
|
|
GLboolean debug = GL_FALSE, forward = GL_FALSE, list = GL_FALSE; |
|
|
|
GLboolean debug = GL_FALSE, forward = GL_FALSE, list = GL_FALSE; |
|
|
|
GLint flags, mask; |
|
|
|
GLint flags, mask; |
|
|
|
GLFWwindow* window; |
|
|
|
GLFWwindow* window; |
|
|
|
|
|
|
|
|
|
|
|
while ((ch = getopt(argc, argv, "a:dfhlm:n:p:r:")) != -1) |
|
|
|
while ((ch = getopt(argc, argv, "a:b:dfhlm:n:p:s:")) != -1) |
|
|
|
{ |
|
|
|
{ |
|
|
|
switch (ch) |
|
|
|
switch (ch) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -208,6 +212,17 @@ int main(int argc, char** argv) |
|
|
|
exit(EXIT_FAILURE); |
|
|
|
exit(EXIT_FAILURE); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case 'b': |
|
|
|
|
|
|
|
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; |
|
|
|
case 'd': |
|
|
|
case 'd': |
|
|
|
debug = GL_TRUE; |
|
|
|
debug = GL_TRUE; |
|
|
|
break; |
|
|
|
break; |
|
|
@ -237,7 +252,7 @@ int main(int argc, char** argv) |
|
|
|
exit(EXIT_FAILURE); |
|
|
|
exit(EXIT_FAILURE); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'r': |
|
|
|
case 's': |
|
|
|
if (strcasecmp(optarg, STRATEGY_NAME_NONE) == 0) |
|
|
|
if (strcasecmp(optarg, STRATEGY_NAME_NONE) == 0) |
|
|
|
strategy = GLFW_NO_RESET_NOTIFICATION; |
|
|
|
strategy = GLFW_NO_RESET_NOTIFICATION; |
|
|
|
else if (strcasecmp(optarg, STRATEGY_NAME_LOSE) == 0) |
|
|
|
else if (strcasecmp(optarg, STRATEGY_NAME_LOSE) == 0) |
|
|
@ -285,6 +300,9 @@ int main(int argc, char** argv) |
|
|
|
if (strategy) |
|
|
|
if (strategy) |
|
|
|
glfwWindowHint(GLFW_CONTEXT_ROBUSTNESS, strategy); |
|
|
|
glfwWindowHint(GLFW_CONTEXT_ROBUSTNESS, strategy); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (behavior) |
|
|
|
|
|
|
|
glfwWindowHint(GLFW_CONTEXT_RELEASE_BEHAVIOR, behavior); |
|
|
|
|
|
|
|
|
|
|
|
glfwWindowHint(GLFW_RED_BITS, GLFW_DONT_CARE); |
|
|
|
glfwWindowHint(GLFW_RED_BITS, GLFW_DONT_CARE); |
|
|
|
glfwWindowHint(GLFW_GREEN_BITS, GLFW_DONT_CARE); |
|
|
|
glfwWindowHint(GLFW_GREEN_BITS, GLFW_DONT_CARE); |
|
|
|
glfwWindowHint(GLFW_BLUE_BITS, GLFW_DONT_CARE); |
|
|
|
glfwWindowHint(GLFW_BLUE_BITS, GLFW_DONT_CARE); |
|
|
|