diff --git a/src/modules/graphics/opengl/Canvas.cpp b/src/modules/graphics/opengl/Canvas.cpp index d706148dd..97949a67d 100644 --- a/src/modules/graphics/opengl/Canvas.cpp +++ b/src/modules/graphics/opengl/Canvas.cpp @@ -521,7 +521,8 @@ void Canvas::stopGrab(bool switchingToOtherCanvas) // Make sure the canvas texture is up to date if we're using MSAA. resolveMSAA(false); - gl.matrices.projection.pop_back(); + if (gl.matrices.projection.size() > 1) + gl.matrices.projection.pop_back(); if (!switchingToOtherCanvas) { diff --git a/src/modules/graphics/opengl/Graphics.cpp b/src/modules/graphics/opengl/Graphics.cpp index fcf2b41f5..9a7d2d2a6 100644 --- a/src/modules/graphics/opengl/Graphics.cpp +++ b/src/modules/graphics/opengl/Graphics.cpp @@ -252,8 +252,6 @@ bool Graphics::setMode(int width, int height) created = true; - setViewportSize(width, height); - // Enable blending glEnable(GL_BLEND); @@ -310,6 +308,8 @@ bool Graphics::setMode(int width, int height) if (quadIndices == nullptr) quadIndices = new QuadIndices(20); + setViewportSize(width, height); + // Restore the graphics state. restoreState(states.back());