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

refactor screenshot code #54

Merged
merged 18 commits into from
Oct 10, 2024
Merged

refactor screenshot code #54

merged 18 commits into from
Oct 10, 2024

Conversation

Salam-Dalloul
Copy link

Issue: The use of preserveDrawingBuffer: true in the WebGL renderer can negatively impact performance. This setting is typically used to retain canvas content for tasks like taking screenshots. However, when preserveDrawingBuffer is set to false (the default), WebGL clears the drawing buffer after each frame, allowing for efficient memory management and optimal performance. When set to true, the buffer contents are preserved between frames, leading to increased memory usage and reduced rendering efficiency, which can significantly affect overall performance.

Solution: By default, preserveDrawingBuffer is set to false to improve performance during normal rendering.
A temporary WebGL renderer with preserveDrawingBuffer: true is created only when taking a screenshot to ensure the content is retained without affecting the performance during regular use.

Screen.Recording.2024-10-02.at.4.38.54.PM.mov

if (blob) {
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
link.download = "screenshot.png";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (non-blocking): I would prefer a more meaningful download name (potentially one that uses the workspace name or active neurons) but we can keep it like this until it becomes a request from the customer (if it happens)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@afonsobspinto i have updated the code for both screenshot and recording files naming with the workspace name

Copy link
Member

@aranega aranega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good to me, I would just do a small modification (almost nothing), but more to keep consistent with the rest of the base code.

@aranega aranega self-requested a review October 3, 2024 10:28
Copy link
Member

@aranega aranega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Salam-Dalloul Thanks a lot 🙏 !

@aranega aranega changed the base branch from feature/CELE-29 to develop October 9, 2024 15:23
ddelpiano and others added 2 commits October 10, 2024 17:03
#96 implement background colour change function
@ddelpiano ddelpiano merged commit d68be55 into develop Oct 10, 2024
8 checks passed
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

Successfully merging this pull request may close these issues.

4 participants