glws::Drawable *drawable = NULL;
glws::Context *context = NULL;
-int window_width = 256, window_height = 256;
-
unsigned frame = 0;
long long startTime = 0;
bool wait = false;
void frame_complete(unsigned call_no) {
++frame;
- if (snapshot_prefix || compare_prefix) {
+ if (drawable &&
+ (snapshot_prefix || compare_prefix)) {
Image::Image *ref = NULL;
if (compare_prefix) {
char filename[PATH_MAX];
std::cout << "Read " << filename << "\n";
}
- Image::Image src(window_width, window_height, true);
+ Image::Image src(drawable->width, drawable->height, true);
snapshot(src);
if (snapshot_prefix) {
retrace::retrace_call(*call);
}
- if (!insideGlBeginEnd && call->no >= dump_state) {
+ if (!insideGlBeginEnd &&
+ drawable && context &&
+ call->no >= dump_state) {
state_dump(std::cout);
exit(0);
}
ws = glws::createNativeWindowSystem();
visual = ws->createVisual(double_buffer);
- drawable = ws->createDrawable(visual);
- drawable->resize(window_width, window_height);
- context = ws->createContext(visual);
- ws->makeCurrent(drawable, context);
for ( ; i < argc; ++i) {
if (parser.open(argv[i])) {