mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
f82ec48e95
commit
d9dd887cb1
3 changed files with 12 additions and 6 deletions
|
|
@ -36,10 +36,16 @@ if __name__ == "__main__":
|
|||
renderer.render(camera, [vm, vm2])
|
||||
image = renderer.get_pixels()
|
||||
print(image.shape)
|
||||
Image.fromarray(image,'RGBA').show()
|
||||
Image.fromarray(image, "RGBA").show()
|
||||
exit(0)
|
||||
win = Window(width=1920, height=1080,vsync=True, config= Config(double_buffer=True,samples=4))
|
||||
win = Window(
|
||||
width=1920,
|
||||
height=1080,
|
||||
vsync=True,
|
||||
config=Config(double_buffer=True, samples=4),
|
||||
)
|
||||
renderer.use_window_fbo()
|
||||
|
||||
@win.event
|
||||
def on_close():
|
||||
win.close()
|
||||
|
|
@ -47,7 +53,7 @@ if __name__ == "__main__":
|
|||
|
||||
@win.event
|
||||
def on_mouse_motion(x, y, dx, dy):
|
||||
vm.move_to((14.2222*(x/1920-0.5),8*(y/1080-0.5),0))
|
||||
vm.move_to((14.2222 * (x / 1920 - 0.5), 8 * (y / 1080 - 0.5), 0))
|
||||
# vm.set_color(col.RED.interpolate(col.GREEN,x/1920))
|
||||
# print(x,y)
|
||||
|
||||
|
|
|
|||
|
|
@ -378,8 +378,8 @@ class OpenGLRenderer(Renderer):
|
|||
)
|
||||
|
||||
def get_pixels(self) -> ImageType:
|
||||
raw = self.output_fbo.read(components=4, dtype='f1',clamp=True) # RGBA, floats
|
||||
buf = np.frombuffer(raw, dtype=np.uint8).reshape((1080,1920,-1))
|
||||
raw = self.output_fbo.read(components=4, dtype="f1", clamp=True) # RGBA, floats
|
||||
buf = np.frombuffer(raw, dtype=np.uint8).reshape((1080, 1920, -1))
|
||||
return buf
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class Renderer(ABC):
|
|||
(ImageMobject, self.render_image),
|
||||
]
|
||||
|
||||
def render(self, camera, renderables: list[OpenGLVMobject])->None : # Image
|
||||
def render(self, camera, renderables: list[OpenGLVMobject]) -> None: # Image
|
||||
self.pre_render(camera)
|
||||
for mob in renderables:
|
||||
for type, render_func in self.capabilities:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue