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

Allow null clear color to disable clearing screen #30

Merged
merged 3 commits into from
Mar 2, 2024

Conversation

Frosty-J
Copy link
Contributor

@Frosty-J Frosty-J commented Feb 25, 2024

There may be a better way of going about this, but it's what I'm doing. Tested on desktop and GWT.

Clearing the screen can harm frame rates slightly (relative to how complex your scene is to render) on Intel integrated graphics (especially when not also clearing the depth buffer?), so in cases where the areas not drawn to are static I prefer not to clear it. When using a proper graphics card, it doesn't seem to make much difference.

Click for fun facts for when drawing directly to the screen buffer (not really relevant to this pull request)
  • On GWT, you don't need to clear. Not unless config.preserveDrawingBuffer = true, maybe (haven't tested it; don't see much of a need to).
  • If only clearing on resize, such as for games that have pillarboxing, it's good to clear in render() a couple times due to double buffering.
  • For some games, it may be a good idea to clear anyway (such as in case the player ends up out of bounds and is subjected to it flickering between buffers).

@crykn crykn self-assigned this Feb 25, 2024
@crykn crykn added the type: enhancement Make an existing feature better label Feb 25, 2024
@crykn crykn merged commit c80db93 into crykn:master Mar 2, 2024
1 check passed
@Frosty-J Frosty-J deleted the no-clear branch March 2, 2024 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Make an existing feature better
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants