Merge :class:~.OpenGLMobject and :class:~.Mobject (#1167)

* Update mobject.py

* 2 test failed

* Update mobject.py

* fix set_rgba_array

* finish

* no errors with cairo so far

* SurfaceExample partially works

* SquareToCircle works

* Update opengl_mobject.py

* SurfaceExample works without  Textures

* More updates

* all opengl examples work pefectly

* Update opengl_surface.py

* fix test case

* fix flake8 and refactor code

* remove all OpenGLMobject related code

* add functions from OpenGL

* remove comments

* Fix bug
This commit is contained in:
Mohammad Al-Fetyani 2021-03-26 22:11:25 +03:00 committed by GitHub
commit e18db42ae1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 822 additions and 1802 deletions

View file

@ -54,13 +54,42 @@ class InteractiveDevelopment(Scene):
# always(circle.move_to, self.mouse_point)
class SquareToCircle(Scene):
def construct(self):
square = OpenGLSquare()
circle = OpenGLCircle()
self.add(square)
self.wait()
self.play(Transform(square, circle))
self.wait()
class UpdaterTest(Scene):
def construct(self):
squares = OpenGLVGroup()
for _ in range(9):
squares.add(OpenGLSquare(1, stroke_opacity=0).set_fill(WHITE, 0.5))
squares.arrange_in_grid(3, 3, buff=0)
def line():
return OpenGLLine(ORIGIN, squares.get_corner(UL))
self.add(always_redraw(line))
self.play(squares.animate.to_edge(UP))
self.play(squares.animate.to_edge(DR))
self.play(squares.animate.shift(LEFT * 10))
self.wait()
class SurfaceExample(Scene):
def construct(self):
# surface_text = Text("For 3d scenes, try using surfaces")
# surface_text.fix_in_frame()
# surface_text.to_edge(UP)
# self.add(surface_text)
# self.wait(0.1)
surface_text = Tex("For 3d scenes, try using surfaces")
surface_text.fix_in_frame()
surface_text.to_edge(UP)
self.add(surface_text)
self.wait(0.1)
torus1 = OpenGLTorus(r1=1, r2=1)
torus2 = OpenGLTorus(r1=3, r2=1)
@ -123,7 +152,6 @@ class SurfaceExample(Scene):
# light_text = Text("You can move around the light source")
# light_text.move_to(surface_text)
# light_text.fix_in_frame()
# self.play(FadeTransform(surface_text, light_text))
light = self.camera.light_source
self.add(light)