# HG changeset patch # User Matti Hamalainen # Date 1572207617 -7200 # Node ID 95dd5417e7de18b2ae3e68540c51c80918e825b6 # Parent 4d6fec8f0c64f1cc4c8f340a45605f2c4dd73869 Add simple help. diff -r 4d6fec8f0c64 -r 95dd5417e7de glxdragon.cpp --- a/glxdragon.cpp Sun Oct 27 22:09:38 2019 +0200 +++ b/glxdragon.cpp Sun Oct 27 22:20:17 2019 +0200 @@ -294,15 +294,31 @@ struct Mesh dragonMesh; std::string dragonVS, dragonFS; std::clock_t startTime; - bool exitFlag = false; + bool exitFlag = false, opt_showhelp = false; int steps = 0; // Check commandline argument for enabling shaders - if (argc > 1 && - (strstr(argv[1], "glsl") != NULL || - strstr(argv[1], "sha") != NULL)) - opt_shaders = true; + for (int narg = 1; narg < argc; narg++) + { + char *arg = argv[narg]; + if (strstr(arg, "help") != NULL || + strstr(arg, "?") != NULL) + opt_showhelp = true; + else + if (strstr(arg, "glsl") != NULL || + strstr(arg, "sha") != NULL) + opt_shaders = true; + } + + if (opt_showhelp) + { + printf( + "Usage: %s [glsl]\n" + "glsl argument will turn on GLSL shader mode instead of basic OpenGL lighting.\n" + , argv[0]); + goto exit; + } if (!dmLoadMesh("dragon.mesh", dragonMesh, 100139, 200198)) goto exit;