#include "glproc.hpp"
#include "glstate.hpp"
-
-#include <GL/glut.h>
+#include "glws.hpp"
static bool double_buffer = false;
static bool insideGlBeginEnd = false;
print r'''
static Trace::Parser parser;
-
-static void display_noop(void) {
-}
+static glws::WindowSystem *__ws = NULL;
+static glws::Visual *__visual = NULL;
+static glws::Drawable *__drawable = NULL;
+static glws::Context *__context = NULL;
#include "image.hpp"
delete ref;
}
}
+
+ if (__reshape_window) {
+ // XXX: doesn't quite work
+ __drawable->resize(__window_width, __window_height);
+ __reshape_window = false;
+ }
+ __ws->processEvents();
}
static void display(void) {
};
frame_complete();
if (double_buffer)
- glutSwapBuffers();
+ __drawable->swapBuffers();
else
glFlush();
-
- // Return now to allow GLUT to resize the window.
- delete call;
- return;
} else if (name == "glXMakeCurrent" ||
name == "wglMakeCurrent") {
glFlush();
if (!double_buffer) {
frame_complete();
- // Return now to allow GLUT to resize window.
- delete call;
- return;
}
} else {
continue;
}
if (__wait) {
- glutDisplayFunc(&display_noop);
- glutIdleFunc(NULL);
+ while (__ws->processEvents()) {}
} else {
exit(0);
}
}
-static void idle(void) {
- if (__reshape_window) {
- // XXX: doesn't quite work
- glutReshapeWindow(__window_width, __window_height);
- __reshape_window = false;
- }
- glutPostRedisplay();
-}
-
static void usage(void) {
std::cout <<
"Usage: glretrace [OPTION] TRACE\n"
}
}
- glutInit(&argc, argv);
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(__window_width, __window_height);
- glutInitDisplayMode(GLUT_DEPTH | GLUT_RGB | (double_buffer ? GLUT_DOUBLE : GLUT_SINGLE));
- glutCreateWindow(argv[0]);
-
- glutDisplayFunc(&display);
- glutIdleFunc(&idle);
+ __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])) {
__startTime = OS::GetTime();
- glutMainLoop();
+ display();
parser.close();
}
}