Skip to content

Commit

Permalink
CanvasWindow: Tested how changing Canvas GL format works on the fly
Browse files Browse the repository at this point in the history
The context is reset, losing all GL state and textures...
  • Loading branch information
skyjake committed May 4, 2012
1 parent 0a75960 commit 849dcce
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions doomsday/engine/portable/src/canvaswindow.cpp
Expand Up @@ -93,6 +93,14 @@ void CanvasWindow::initCanvasAfterRecreation(Canvas& canvas)

void CanvasWindow::recreateCanvas()
{
// Update the GL format for subsequently created Canvases.
setDefaultGLFormat();

#if 0
canvas().setFormat(QGLFormat::defaultFormat());
LOG_DEBUG("Updated Canvas GL format.");

#else
/// @todo Instead of recreating, there is also the option of modifying the
/// existing QGLContext -- however, changing its format causes it to be
/// reset. We are doing it this way because we wish to retain the current
Expand All @@ -106,9 +114,6 @@ void CanvasWindow::recreateCanvas()
d->mouseWasTrapped = canvas().isMouseTrapped();
canvas().trapMouse(false);

// Update the GL format for subsequently created Canvases.
setDefaultGLFormat();

// Create the replacement Canvas. Once it's created and visible, we'll
// finish the switch-over.
d->recreated = new Canvas(this, d->canvas);
Expand All @@ -118,6 +123,7 @@ void CanvasWindow::recreateCanvas()
d->recreated->show();

LOG_DEBUG("Canvas recreated, old one still exists");
#endif
}

Canvas& CanvasWindow::canvas()
Expand Down

0 comments on commit 849dcce

Please sign in to comment.