typedef std::map<unsigned long long, glws::Drawable *> DrawableMap;
-typedef std::map<unsigned long long, glws::Context *> ContextMap;
+typedef std::map<unsigned long long, Context *> ContextMap;
static DrawableMap drawable_map;
static ContextMap context_map;
-static glws::Context *sharedContext = NULL;
+static Context *sharedContext = NULL;
static glws::Drawable *
DrawableMap::const_iterator it;
it = drawable_map.find(drawable_id);
if (it == drawable_map.end()) {
- return (drawable_map[drawable_id] = glws::createDrawable(visual[glretrace::defaultProfile]));
+ return (drawable_map[drawable_id] = glretrace::createDrawable());
}
return it->second;
}
-static glws::Context *
+static Context *
getContext(unsigned long long ctx) {
if (ctx == 0) {
return NULL;
ContextMap::const_iterator it;
it = context_map.find(ctx);
if (it == context_map.end()) {
- glws::Context *context;
- context_map[ctx] = context = glws::createContext(visual[glretrace::defaultProfile], sharedContext, glretrace::defaultProfile, retrace::debug);
+ Context *context;
+ context_map[ctx] = context = glretrace::createContext(sharedContext);
if (!sharedContext) {
sharedContext = context;
}
unsigned long long ctx = call.arg(0).toUIntPtr();
glws::Drawable *new_drawable = getDrawable(ctx);
- glws::Context *new_context = getContext(ctx);
+ Context *new_context = getContext(ctx);
- bool result = glws::makeCurrent(new_drawable, new_context);
-
- if (new_drawable && new_context && result) {
- drawable = new_drawable;
- context = new_context;
- } else {
- drawable = NULL;
- context = NULL;
- }
+ glretrace::makeCurrent(call, new_drawable, new_context);
}
static void retrace_CGLFlushDrawable(trace::Call &call) {
- if (drawable && context) {
+ if (currentDrawable && currentContext) {
if (retrace::doubleBuffer) {
- drawable->swapBuffers();
+ currentDrawable->swapBuffers();
} else {
glFlush();
}