Skip to content

Commit

Permalink
Issue #8084: DesktopGL GraphicsDevice.ScissorRectangle Fix (#8284)
Browse files Browse the repository at this point in the history
* Fixed ScissorRectangle Bug Noted in Issue #8084

The fix to this problem was testing to see if the ScissorRectangle was enabled and resizing it whenever the viewport was resized. This was not done by default for DesktopGL as far as I could tell.

* Resolving comments from PR.

Resolving Simon's comment with regards to the placement of the conditional.
  • Loading branch information
samercer2002 committed May 18, 2024
1 parent d26be94 commit 94c4ada
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions MonoGame.Framework/Platform/SDL/SDLGameWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ public void ClientResize(int width, int height)
_game.GraphicsDevice.PresentationParameters.BackBufferHeight == height) {
return;
}

if (_game.GraphicsDevice.RasterizerState.ScissorTestEnable && _game.GraphicsDevice.ScissorRectangle == _game.GraphicsDevice.Viewport.Bounds)
_game.GraphicsDevice.ScissorRectangle = new Rectangle(0, 0, width, height);

_game.GraphicsDevice.PresentationParameters.BackBufferWidth = width;
_game.GraphicsDevice.PresentationParameters.BackBufferHeight = height;
_game.GraphicsDevice.Viewport = new Viewport(0, 0, width, height);
Expand Down

0 comments on commit 94c4ada

Please sign in to comment.