mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
we need make_current() in the flip after all
This commit is contained in:
parent
6f956e1fe7
commit
f709ae9232
@ -160,13 +160,16 @@ make_current() {
|
|||||||
|
|
||||||
wglGraphicsStateGuardian *wglgsg;
|
wglGraphicsStateGuardian *wglgsg;
|
||||||
DCAST_INTO_V(wglgsg, _gsg);
|
DCAST_INTO_V(wglgsg, _gsg);
|
||||||
wglMakeCurrent(_hdc, wglgsg->get_context(_hdc));
|
HGLRC context = wglgsg->get_context(_hdc);
|
||||||
|
if (context) {
|
||||||
|
wglMakeCurrent(_hdc, context);
|
||||||
|
|
||||||
// Now that we have made the context current to a window, we can
|
// Now that we have made the context current to a window, we can
|
||||||
// reset the GSG state if this is the first time it has been used.
|
// reset the GSG state if this is the first time it has been used.
|
||||||
// (We can't just call reset() when we construct the GSG, because
|
// (We can't just call reset() when we construct the GSG, because
|
||||||
// reset() requires having a current context.)
|
// reset() requires having a current context.)
|
||||||
wglgsg->reset_if_new();
|
wglgsg->reset_if_new();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -201,6 +204,12 @@ release_gsg() {
|
|||||||
void wglGraphicsWindow::
|
void wglGraphicsWindow::
|
||||||
begin_flip() {
|
begin_flip() {
|
||||||
if (_hdc) {
|
if (_hdc) {
|
||||||
|
// It turns out that if we don't call make_current() before
|
||||||
|
// calling SwapBuffers() on a Matrix card, we crash a horrible
|
||||||
|
// death. This is a pity since make_current() seems unnecessary
|
||||||
|
// on other cards, and does incur some performance overhead.
|
||||||
|
make_current();
|
||||||
|
|
||||||
SwapBuffers(_hdc);
|
SwapBuffers(_hdc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user