Esempio n. 1
0
void Context::draw(HDC hdc) {
	HGLRC oldctx = owglGetCurrentContext();
	HDC oldhdc = owglGetCurrentDC();
	owglMakeCurrent(hdc, ctx);

	doDraw(hdc);

	owglMakeCurrent(oldhdc, oldctx);
}
Esempio n. 2
0
Context::Context(HDC hdc) {
	timeT = clock();
	frameCount = 0;

	texture = ~0;
	ctx = owglCreateContext(hdc);

	HGLRC oldctx = owglGetCurrentContext();
	HDC oldhdc = owglGetCurrentDC();
	owglMakeCurrent(hdc, ctx);

	initContext();

	owglMakeCurrent(oldhdc, oldctx);
}
Esempio n. 3
0
static void doSwap(HDC hdc) {
    HGLRC oldctx = owglGetCurrentContext();
    HDC oldhdc = owglGetCurrentDC();
    Context *c = contexts[hdc];

    if (!c) {
        ods("OpenGL: New context for device %p", hdc);
        c = new Context(hdc);
        contexts[hdc] = c;
    } else {
        ods("OpenGL: Reusing old context");
        owglMakeCurrent(hdc, c->ctx);
    }
    c->draw(hdc);
    owglMakeCurrent(oldhdc, oldctx);
}