long long __startTime = 0;
static enum {
MODE_DISPLAY = 0,
- MODE_SCREENSHOT,
+ MODE_SNAPSHOT,
MODE_COMPARE,
} __mode = MODE_DISPLAY;
+const char *__snapshot_prefix = "";
+
static void
checkGlError(void) {
static void frame_complete(void) {
++__frame;
- if (!__reshape_window && (__mode == MODE_SCREENSHOT || __mode == MODE_COMPARE)) {
+ if (!__reshape_window && (__mode == MODE_SNAPSHOT || __mode == MODE_COMPARE)) {
char filename[PATH_MAX];
- snprintf(filename, sizeof filename, "screenshot_%04u.png", __frame);
+ snprintf(filename, sizeof filename, "%s%04u.png", __snapshot_prefix, __frame);
Image::Image *ref;
if (__mode == MODE_COMPARE) {
Image::Image src(__window_width, __window_height, true);
glReadPixels(0, 0, __window_width, __window_height, GL_RGBA, GL_UNSIGNED_BYTE, src.pixels);
- if (__mode == MODE_SCREENSHOT) {
+ if (__mode == MODE_SNAPSHOT) {
if (src.writePNG(filename) && verbosity) {
std::cout << "Wrote " << filename << "\n";
}
"Usage: glretrace [OPTION] TRACE\n"
"Replay TRACE.\n"
"\n"
- " -c compare against screenshots\n"
+ " -c compare against snapshots\n"
" -db use a double buffer visual\n"
+ " -p PREFIX snapshot prefix\n"
" -s take snapshots\n"
" -v verbose output\n";
}
} else if (!strcmp(arg, "--help")) {
usage();
return 0;
+ } else if (!strcmp(arg, "-p")) {
+ __snapshot_prefix = argv[++i];
} else if (!strcmp(arg, "-s")) {
- __mode = MODE_SCREENSHOT;
+ __mode = MODE_SNAPSHOT;
} else if (!strcmp(arg, "-v")) {
++verbosity;
} else {