From 72780959212f3071ea92b199a75647d55ad6f04d Mon Sep 17 00:00:00 2001 From: Fuwuwuwu <72070458+floatwoozy@users.noreply.github.com> Date: Sun, 3 Sep 2023 08:55:03 +0800 Subject: [PATCH] Change ImageMobject rendering mode to TRIANGLES And add vertices --- manimlib/mobject/types/image_mobject.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/manimlib/mobject/types/image_mobject.py b/manimlib/mobject/types/image_mobject.py index 80efe5aa..20e8ddae 100644 --- a/manimlib/mobject/types/image_mobject.py +++ b/manimlib/mobject/types/image_mobject.py @@ -2,6 +2,7 @@ from __future__ import annotations import numpy as np from PIL import Image +from moderngl import TRIANGLES from manimlib.constants import DL, DR, UL, UR from manimlib.mobject.mobject import Mobject @@ -24,6 +25,7 @@ class ImageMobject(Mobject): ('im_coords', np.float32, (2,)), ('opacity', np.float32, (1,)), ] + render_primitive: int = TRIANGLES def __init__( self, @@ -37,9 +39,9 @@ class ImageMobject(Mobject): super().__init__(texture_paths={"Texture": self.image_path}, **kwargs) def init_data(self) -> None: - super().init_data(length=4) - self.data["point"][:] = [UL, DL, UR, DR] - self.data["im_coords"][:] = [(0, 0), (0, 1), (1, 0), (1, 1)] + super().init_data(length=6) + self.data["point"][:] = [UL, DL, UR, DR, UR, DL] + self.data["im_coords"][:] = [(0, 0), (0, 1), (1, 0), (1, 1), (1, 0), (0, 1)] self.data["opacity"][:] = self.opacity def init_points(self) -> None: