Skip to content

DRAFT: remove all OpenGL<x> mobs and the ConvertToOpenGL metaclass. #2454

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

Closed
wants to merge 19 commits into from

Conversation

hydrobeam
Copy link
Member

Overview: What does this pull request change?

The theme of this PR is removing all OpengGL<x> mobs and the consequences of their existence. It's still a work in progress, but I decided to share it as a proof of concept for how to approach addressing the problem.

The commit history outlines the changes, but here are specific descriptions of what was done:

Summary of changes:

  • (almost) All mentions of OpenGL mobs were removed across the library
    • Notable exception of opengl tests, which I wasn't sure how to deal with
  • almost all if config.renderer/config["renderer"] == "opengl" checks were removed from the library.
    • The "opengl" choices in these checks were kept.
  • opengl_geometry.py was removed.

OpenGLMobject --> Mobject

  • mobject.py was removed, and opengl_mobject.py was renamed to mobject.py.
  • All OpenGL prefixes in the file were removed.
    • i.e. OpenGLGroup -> Group

OpenGLVMobject --> VMobject

  • vectorized_mobject.py was removed, and opengl_vectorized_mobject.py was renamed to vectorized_mobject.py.
  • Adjusted implementation for DashedVMobject was ported over to OpenGLDashedVMobject
  • VDict was ported over to the file.
  • OpenGL prefixes were removed.

OpenGLSurface (and related 3d opengl mobs) -- > Surface

  • opengl_surface.py was renamed to surface.py.
  • opengl_three_dimensions.py was removed, and its only mob of OpenGLSurfaceMesh was moved into surface.py and renamed to SurfaceMesh
  • OpenGL prefixes removed

OpenGLPMobject (and related PMobjects) --> PMobject

  • point_cloud_mobject.py was removed and opengl_point_cloud_mobject.py was renamed to point_cloud_mobject.py.
  • OpenGL prefixes were removed.

ConvertToOpenGL

  • opengl_compatibilty.py was removed, and all mentions to it too.

  • all metaclass = ConvertToOpenGL in class definitions were removed.

    • i.e. for Axes / mobs in geometry.py and three_dimensions.py.
  • removed manim.opengl import in self.interactive_embed() too.

Outcome

with the following command:

manim -p mkt.py Sun --renderer=opengl

The following scene successfully renders and produces an interactive window.

class Sun(Scene):
    def construct(self):
        a = Axes().add_coordinates().rotate(45 * DEGREES)
        self.add(a)
        self.add(Dot(a.coords_to_point(1, 2)))
        self.interactive_embed()

--renderer=opengl is still required since the flags are not configured properly. Also, manim/__init__.py has not been cleaned up appropiately, so it's currently missing:

from ..renderer.shader import *
from ..utils.opengl import *

that are included in manim/opengl/__init__.py.

There are also some redundant cairo files, such as cairo_renderer.py/camera.py that should be removed.
OpenGL's default camera makes ThreeDScene mostly redundant, but I did not remove it since it still has some useful methods that should be ported beforehand.

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

Instead of further trying to accommodate the clashing implementations in the library, I think the best solution is to simply remove the old Mobject etc.. mobs and have them be replaced by their OpenGL counterparts.

With some notable exceptions such as #2155 #1240 and ImageMobject (in progress at #1837) , the OpenGL renderer generally has the same functionality as cairo. There are almost certainly some bugs / behaviour that we are unaware of, but IMO this PR is a step in the right direction towards solving those issues.

Links to added or changed documentation pages

Docs won't render.

Further Information and Comments

Tests will fail.

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

@hydrobeam hydrobeam added maintenance refactoring, typos, removing clutter/dead code, and other code quality improvements opengl Concerning the OpenGL renderer. labels Jan 9, 2022
@hydrobeam hydrobeam marked this pull request as draft January 9, 2022 08:28
@MrDiver
Copy link
Collaborator

MrDiver commented Jun 18, 2022

Closing in favor of discussing a new architecture first

@MrDiver MrDiver closed this Jun 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance refactoring, typos, removing clutter/dead code, and other code quality improvements opengl Concerning the OpenGL renderer.
Projects
Status: Rejected
Development

Successfully merging this pull request may close these issues.

2 participants