static bool gl_error(const char *func, const char *str) { if (jimglGetCurrentContext() != NULL) { GLenum error = glGetError(); if (error != 0) { hlog("%s: %s: %lu", func, str, error); return true; } } return false; }
static BOOL WINAPI hook_wgl_delete_context(HGLRC hrc) { BOOL ret; if (capture_active()) { HDC last_hdc = jimglGetCurrentDC(); HGLRC last_hrc = jimglGetCurrentContext(); jimglMakeCurrent(data.hdc, hrc); gl_free(); jimglMakeCurrent(last_hdc, last_hrc); } unhook(&wgl_delete_context); BOOL (WINAPI *call)(HGLRC) = wgl_delete_context.call_addr; ret = call(hrc); rehook(&wgl_delete_context); return ret; }