Skip to content

Conversation

@icedcoffeeee
Copy link
Collaborator

Overview: What does this pull request change?

Motivation and Explanation: Why and how do your changes improve the library?

The current OpenGLSurface, when input a colorscale and axes, lag when rotating and moving the camera. This is because the surface recalculates the colors to each point on every frame. This PR stores the color data to be reused every frame.

This was the test Scene used:

from manim import *
from manim.opengl import *


class Test(Scene):
    def construct(self):
        s = OpenGLSurface(
            lambda u, v: np.array([u, v, u * v]),
            [-2, 2],
            [-2, 2],
            colorscale=(PURE_BLUE, PURE_RED),
            axes=ThreeDAxes(),
        )
        self.add(s)
        self.interactive_embed()

Links to added or changed documentation pages

Further Information and Comments

Reviewer Checklist

  • The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
  • If applicable: newly added functions and classes are tested

@alembcke
Copy link
Contributor

Does this accomplish the same thing as #3119?

@icedcoffeeee
Copy link
Collaborator Author

@alembcke I have tested and no, the pr does not fix this problem.

Copy link
Member

@behackl behackl left a comment

Choose a reason for hiding this comment

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

LGTM

@behackl behackl added enhancement Additions and improvements in general opengl Concerning the OpenGL renderer. labels Mar 28, 2023
@behackl behackl merged commit b9784a0 into ManimCommunity:main Mar 28, 2023
@behackl behackl changed the title Store color data to prevent opengl embed lag Performance: Store color data of OpenGLSurface to prevent OpenGL embed lag Mar 31, 2023
@icedcoffeeee icedcoffeeee deleted the surface-color-lag branch August 1, 2023 11:39
@behackl behackl added this to the v0.18.0 milestone Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Additions and improvements in general opengl Concerning the OpenGL renderer.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants