Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DesktopGL: GraphicsDevice.ScissorRectangle is set only once and isn't updated if the window gets resized #8084

Closed
2 tasks done
rds1983 opened this issue Oct 23, 2023 · 3 comments

Comments

@rds1983
Copy link
Contributor

rds1983 commented Oct 23, 2023

Prerequisites

  • I have verified this issue is not present in the develop branch
  • I have searched open and closed issues to ensure it has not already been reported.

MonoGame Version

MonoGame 3.8.1.303

Which MonoGame platform are you using?

MonoGame Cross-Platform Desktop Application (mgdesktopgl)

Operating System

Windows

Description

GraphicsDevice.ScissorRectangle is set to wrong value if GraphicsDevice.Clear is called.
Initially ScissorRectangle is set to the window size on the initialization:

ScissorRectangle = _viewport.Bounds;

And seems that it never gets updated.

Steps to Reproduce

  1. Unpack the attached sample, open in the IDE and run.
  2. Resize the window.
  3. Notice that the image gets cut. That happens because of the wrong Graphics.ScissorRectangle.

Minimal Example Repo

No response

Expected Behavior

GraphicsRectangle should be synchronized with the ViewPort. That's how it works for MonoGame.WindowsDX.

Resulting Behavior

scissorBug.mp4

Files

MGScissorResize.zip

@Mindfulplays
Copy link
Contributor

When the viewport gets resized, doesn't it update both Viewport and ScissorRectangle ?

@rds1983
Copy link
Contributor Author

rds1983 commented Nov 14, 2023

Well, check the sample. It's quite simple and the image shouldn't be cut on resize. But it is cut.
Moreover it works properly for MonoGame.WindowsDX.

@samercer2002
Copy link
Contributor

Hello, as this issue seems to still be present, is it open for me to take a look at? I'd like to work on it.

samercer2002 added a commit to samercer2002/MonoGame that referenced this issue Apr 18, 2024
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.
mrhelmut pushed a commit that referenced this issue May 18, 2024
* 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@rds1983 @mrhelmut @Mindfulplays @samercer2002 and others