From cae4afeb3c58d162668ea0133368faa20a75f5cd Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Sat, 23 Mar 2024 17:00:10 +0100 Subject: [PATCH 1/4] Make clear() more reasonable --- arcade/application.py | 42 ++++++++++++--------- arcade/examples/gl/3d_cube_with_cubes.py | 4 +- arcade/experimental/clock/clock_window.py | 33 +++++++++------- arcade/gl/buffer.py | 2 +- arcade/gl/framebuffer.py | 46 +++++++++++++---------- arcade/perf_graph.py | 2 +- arcade/text.py | 2 +- doc/tutorials/shader_inputs/textures.py | 4 +- tests/unit/gl/test_opengl_framebuffer.py | 4 +- 9 files changed, 79 insertions(+), 60 deletions(-) diff --git a/arcade/application.py b/arcade/application.py index 21651c913..ba604f7b6 100644 --- a/arcade/application.py +++ b/arcade/application.py @@ -21,7 +21,7 @@ from arcade import set_window from arcade.color import TRANSPARENT_BLACK from arcade.context import ArcadeContext -from arcade.types import Color, RGBA255, RGBA255OrNormalized +from arcade.types import Color, RGBOrA255, RGBANormalized from arcade import SectionManager from arcade.utils import is_raspberry_pi @@ -260,10 +260,10 @@ def ctx(self) -> ArcadeContext: return self._ctx def clear( - self, - color: Optional[RGBA255OrNormalized] = None, - normalized: bool = False, - viewport: Optional[Tuple[int, int, int, int]] = None, + self, + color: Optional[RGBOrA255] = None, + color_normalized: Optional[RGBANormalized] = None, + viewport: Optional[Tuple[int, int, int, int]] = None, ): """Clears the window with the configured background color set through :py:attr:`arcade.Window.background_color`. @@ -272,14 +272,18 @@ def clear( with one of the following: 1. A :py:class:`~arcade.types.Color` instance - 2. A 4-length RGBA :py:class:`tuple` of byte values (0 to 255) - 3. A 4-length RGBA :py:class:`tuple` of normalized floats (0.0 to 1.0) + 2. A 3 or 4-length RGB/RGBA :py:class:`tuple` of byte values (0 to 255) + + :param color_normalized: (Optional) override the current background color + using normalized values (0.0 to 1.0). For example, (1.0, 0.0, 0.0, 1.0) + making the window contents red. - :param normalized: If the color format is normalized (0.0 -> 1.0) or byte values :param Tuple[int, int, int, int] viewport: The viewport range to clear """ - color = color if color is not None else self.background_color - self.ctx.screen.clear(color, normalized=normalized, viewport=viewport) + # Use the configured background color if none is provided + if color is None and color_normalized is None: + color = self.background_color + self.ctx.screen.clear(color=color, color_normalized=color_normalized, viewport=viewport) @property def background_color(self) -> Color: @@ -310,7 +314,7 @@ def background_color(self) -> Color: return self._background_color @background_color.setter - def background_color(self, value: RGBA255): + def background_color(self, value: RGBOrA255): self._background_color = Color.from_iterable(value) def run(self) -> None: @@ -990,24 +994,26 @@ def add_section(self, section, at_index: Optional[int] = None, at_draw_order: Op def clear( self, - color: Optional[RGBA255OrNormalized] = None, - normalized: bool = False, + color: Optional[RGBOrA255] = None, + color_normalized: Optional[RGBANormalized] = None, viewport: Optional[Tuple[int, int, int, int]] = None, ): - """Clears the View's Window with the configured background color + """Clears the window with the configured background color set through :py:attr:`arcade.Window.background_color`. :param color: (Optional) override the current background color with one of the following: 1. A :py:class:`~arcade.types.Color` instance - 2. A 4-length RGBA :py:class:`tuple` of byte values (0 to 255) - 3. A 4-length RGBA :py:class:`tuple` of normalized floats (0.0 to 1.0) + 2. A 3 or 4-length RGB/RGBA :py:class:`tuple` of byte values (0 to 255) + + :param color_normalized: (Optional) override the current background color + using normalized values (0.0 to 1.0). For example, (1.0, 0.0, 0.0, 1.0) + making the window contents red. - :param normalized: If the color format is normalized (0.0 -> 1.0) or byte values :param Tuple[int, int, int, int] viewport: The viewport range to clear """ - self.window.clear(color, normalized, viewport) + self.window.clear(color=color, color_normalized=color_normalized, viewport=viewport) def on_update(self, delta_time: float): """To be overridden""" diff --git a/arcade/examples/gl/3d_cube_with_cubes.py b/arcade/examples/gl/3d_cube_with_cubes.py index 09663cdaf..9d1a44b66 100644 --- a/arcade/examples/gl/3d_cube_with_cubes.py +++ b/arcade/examples/gl/3d_cube_with_cubes.py @@ -110,8 +110,8 @@ def on_draw(self): # Draw the current cube using the last one as a texture self.fbo1.use() - self.fbo1.clear(color=(1.0, 1.0, 1.0, 1.0), normalized=True) - + self.fbo1.clear(color_normalized=(1.0, 1.0, 1.0, 1.0)) + translate = Mat4.from_translation((0, 0, -1.75)) rx = Mat4.from_rotation(self.time, (1, 0, 0)) ry = Mat4.from_rotation(self.time, (0, 1, 0)) diff --git a/arcade/experimental/clock/clock_window.py b/arcade/experimental/clock/clock_window.py index 97dbf7863..72580dbb7 100644 --- a/arcade/experimental/clock/clock_window.py +++ b/arcade/experimental/clock/clock_window.py @@ -27,7 +27,7 @@ from arcade import NoOpenGLException from arcade.color import TRANSPARENT_BLACK from arcade.context import ArcadeContext -from arcade.types import Color, RGBA255, RGBA255OrNormalized +from arcade.types import Color, RGBOrA255, RGBOrANormalized from arcade import SectionManager from arcade.utils import is_raspberry_pi @@ -262,8 +262,8 @@ def ctx(self) -> ArcadeContext: def clear( self, - color: Optional[RGBA255OrNormalized] = None, - normalized: bool = False, + color: Optional[RGBOrA255] = None, + color_normalized: Optional[RGBOrANormalized] = None, viewport: Optional[Tuple[int, int, int, int]] = None, ): """Clears the window with the configured background color @@ -276,11 +276,14 @@ def clear( 2. A 4-length RGBA :py:class:`tuple` of byte values (0 to 255) 3. A 4-length RGBA :py:class:`tuple` of normalized floats (0.0 to 1.0) - :param normalized: If the color format is normalized (0.0 -> 1.0) or byte values + :param color_normalized: (Optional) override the current background color + with a 4-length RGBA :py:class:`tuple` of normalized floats (0.0 to 1.0) + :param Tuple[int, int, int, int] viewport: The viewport range to clear """ - color = color if color is not None else self.background_color - self.ctx.screen.clear(color, normalized=normalized, viewport=viewport) + if color is None and color_normalized is None: + color = self.background_color + self.ctx.screen.clear(color=color, color_normalized=color_normalized, viewport=viewport) @property def background_color(self) -> Color: @@ -311,7 +314,7 @@ def background_color(self) -> Color: return self._background_color @background_color.setter - def background_color(self, value: RGBA255): + def background_color(self, value: RGBOrA255): self._background_color = Color.from_iterable(value) @property @@ -1001,24 +1004,26 @@ def add_section(self, section, at_index: Optional[int] = None, at_draw_order: Op def clear( self, - color: Optional[RGBA255OrNormalized] = None, - normalized: bool = False, + color: Optional[RGBOrA255] = None, + color_normalized: Optional[RGBOrANormalized] = None, viewport: Optional[Tuple[int, int, int, int]] = None, ): - """Clears the View's Window with the configured background color + """Clears the window with the configured background color set through :py:attr:`arcade.Window.background_color`. :param color: (Optional) override the current background color with one of the following: 1. A :py:class:`~arcade.types.Color` instance - 2. A 4-length RGBA :py:class:`tuple` of byte values (0 to 255) - 3. A 4-length RGBA :py:class:`tuple` of normalized floats (0.0 to 1.0) + 2. A 3 or 4-length RGB/RGBA :py:class:`tuple` of byte values (0 to 255) + + :param color_normalized: (Optional) override the current background color + using normalized values (0.0 to 1.0). For example, (1.0, 0.0, 0.0, 1.0) + making the window contents red. - :param normalized: If the color format is normalized (0.0 -> 1.0) or byte values :param Tuple[int, int, int, int] viewport: The viewport range to clear """ - self.window.clear(color, normalized, viewport) + self.window.ctx.screen.clear(color=color, color_normalized=color_normalized, viewport=viewport) def on_update(self, delta_time: float): """To be overridden""" diff --git a/arcade/gl/buffer.py b/arcade/gl/buffer.py index de7c37d70..6e666197a 100644 --- a/arcade/gl/buffer.py +++ b/arcade/gl/buffer.py @@ -62,7 +62,7 @@ def __init__( gl.glBindBuffer(gl.GL_ARRAY_BUFFER, self._glo) # print(f"glBufferData(gl.GL_ARRAY_BUFFER, {self._size}, data, {self._usage})") - if data is not None and len(data) > 0: + if data is not None and len(data) > 0: # type: ignore self._size, data = data_to_ctypes(data) gl.glBufferData(gl.GL_ARRAY_BUFFER, self._size, data, self._usage) elif reserve > 0: diff --git a/arcade/gl/framebuffer.py b/arcade/gl/framebuffer.py index 649927dc4..67721d6c7 100644 --- a/arcade/gl/framebuffer.py +++ b/arcade/gl/framebuffer.py @@ -2,7 +2,7 @@ from ctypes import c_int, string_at from contextlib import contextmanager -from typing import Optional, Tuple, List, TYPE_CHECKING, Union +from typing import Generator, Optional, Tuple, List, TYPE_CHECKING import weakref @@ -305,7 +305,7 @@ def __exit__(self, exc_type, exc_val, exc_tb): self._prev_fbo.use() @contextmanager - def activate(self): + def activate(self) -> Generator[Framebuffer, None, None]: """Context manager for binding the framebuffer. Unlike the default context manager in this class @@ -348,10 +348,10 @@ def _use(self, *, force: bool = False): def clear( self, - color: Union[RGBOrA255, RGBOrANormalized] = (0.0, 0.0, 0.0, 0.0), *, + color: Optional[RGBOrA255] = None, + color_normalized: Optional[RGBOrANormalized] = None, depth: float = 1.0, - normalized: bool = False, viewport: Optional[Tuple[int, int, int, int]] = None, ): """ @@ -361,12 +361,13 @@ def clear( fb.clear(color=arcade.color.WHITE) # Clear framebuffer using the color red in normalized form - fbo.clear(color=(1.0, 0.0, 0.0, 1.0), normalized=True) + fbo.clear(color_normalized=(1.0, 0.0, 0.0, 1.0)) If the background color is an ``RGB`` value instead of ``RGBA``` we assume alpha value 255. - :param color: A 3 or 4 component tuple containing the color + :param color: A 3 or 4 component tuple containing the color (prioritized over color_normalized) + :param color_normalized: A 3 or 4 component tuple containing the color in normalized form :param depth: Value to clear the depth buffer (unused) :param normalized: If the color values are normalized or not :param Tuple[int, int, int, int] viewport: The viewport range to clear @@ -379,27 +380,34 @@ def clear( else: self.scissor = None - if normalized: - # If the colors are already normalized we can pass them right in + clear_color = 0.0, 0.0, 0.0, 0.0 + if color is not None: if len(color) == 3: - gl.glClearColor(*color, 1.0) + clear_color = color[0] / 255, color[1] / 255, color[2] / 255, 1.0 + elif len(color) == 4: + clear_color = color[0] / 255, color[1] / 255, color[2] / 255, color[3] / 255 else: - gl.glClearColor(*color) - else: - # OpenGL wants normalized colors (0.0 -> 1.0) - if len(color) == 3: - gl.glClearColor(color[0] / 255, color[1] / 255, color[2] / 255, 1.0) + raise ValueError("Color should be a 3 or 4 component tuple") + elif color_normalized is not None: + if len(color_normalized) == 3: + clear_color = color_normalized[0], color_normalized[1], color_normalized[2], 1.0 + elif len(color_normalized) == 4: + clear_color = color_normalized else: - # mypy does not understand that color[3] is guaranteed to work in this codepath, pyright does. - # We can remove this type: ignore if we switch to pyright. - gl.glClearColor( - color[0] / 255, color[1] / 255, color[2] / 255, color[3] / 255 # type: ignore - ) + raise ValueError("Color should be a 3 or 4 component tuple") + + gl.glClearColor(*clear_color) + print("Clearing color buffer with color", clear_color) if self.depth_attachment: + # gl.glClearDepth(depth) gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT) + print("Clearing depth buffer") + print("viewport", self.viewport) + print("scissor", self.scissor) else: gl.glClear(gl.GL_COLOR_BUFFER_BIT) + print("Clearing color buffer only") self.scissor = scissor_values diff --git a/arcade/perf_graph.py b/arcade/perf_graph.py index cf3952e75..44df94352 100644 --- a/arcade/perf_graph.py +++ b/arcade/perf_graph.py @@ -292,7 +292,7 @@ def update_graph(self, delta_time: float): self.minimap_texture, projection=self.proj) as fbo: # Set the background color - fbo.clear(self.background_color) + fbo.clear(color=self.background_color) # Draw lines & their labels for text in self._all_text_objects: diff --git a/arcade/text.py b/arcade/text.py index 8a2879bde..9b2d115c5 100644 --- a/arcade/text.py +++ b/arcade/text.py @@ -651,7 +651,7 @@ def create_text_sprite( texture_atlas = arcade.get_window().ctx.default_atlas texture_atlas.add(texture) with texture_atlas.render_into(texture) as fbo: - fbo.clear(background_color or arcade.color.TRANSPARENT_BLACK) + fbo.clear(color=background_color or arcade.color.TRANSPARENT_BLACK) text_object.draw() return arcade.Sprite( diff --git a/doc/tutorials/shader_inputs/textures.py b/doc/tutorials/shader_inputs/textures.py index f6cb7af4d..f792b91cf 100644 --- a/doc/tutorials/shader_inputs/textures.py +++ b/doc/tutorials/shader_inputs/textures.py @@ -23,8 +23,8 @@ def __init__(self): self.fbo_1 = self.ctx.framebuffer(color_attachments=[self.tex_1]) # Fill the textures with solid colours - self.fbo_0.clear(color=(0.0, 0.0, 1.0, 1.0), normalized=True) - self.fbo_1.clear(color=(1.0, 0.0, 0.0, 1.0), normalized=True) + self.fbo_0.clear(color_normalized=(0.0, 0.0, 1.0, 1.0)) + self.fbo_1.clear(color_normalized=(1.0, 0.0, 0.0, 1.0)) # Create a simple shader program self.prog = self.ctx.program( diff --git a/tests/unit/gl/test_opengl_framebuffer.py b/tests/unit/gl/test_opengl_framebuffer.py index 7877556e7..d8a86c66b 100644 --- a/tests/unit/gl/test_opengl_framebuffer.py +++ b/tests/unit/gl/test_opengl_framebuffer.py @@ -55,8 +55,8 @@ def test_clear(ctx): ctx.window.use() fb = create(ctx, 10, 20, components=4) fb.clear() - fb.clear(color=(0, 0, 0, 0), normalized=True) - fb.clear(color=(0, 0, 0), normalized=True) + fb.clear(color_normalized=(0, 0, 0, 0)) + fb.clear(color_normalized=(0, 0, 0)) fb.clear(color=arcade.csscolor.AZURE) fb.clear(color=(0, 0, 0)) fb.clear(color=(0, 0, 0, 0)) From 97afeb9b5ba2fd8eee868abff17831d97186d2d7 Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Sat, 23 Mar 2024 17:03:26 +0100 Subject: [PATCH 2/4] pep8 --- arcade/application.py | 2 +- arcade/examples/gl/3d_cube_with_cubes.py | 2 +- arcade/experimental/clock/clock_window.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arcade/application.py b/arcade/application.py index ba604f7b6..10d2d4a93 100644 --- a/arcade/application.py +++ b/arcade/application.py @@ -262,7 +262,7 @@ def ctx(self) -> ArcadeContext: def clear( self, color: Optional[RGBOrA255] = None, - color_normalized: Optional[RGBANormalized] = None, + color_normalized: Optional[RGBANormalized] = None, viewport: Optional[Tuple[int, int, int, int]] = None, ): """Clears the window with the configured background color diff --git a/arcade/examples/gl/3d_cube_with_cubes.py b/arcade/examples/gl/3d_cube_with_cubes.py index 9d1a44b66..803193bc8 100644 --- a/arcade/examples/gl/3d_cube_with_cubes.py +++ b/arcade/examples/gl/3d_cube_with_cubes.py @@ -111,7 +111,7 @@ def on_draw(self): # Draw the current cube using the last one as a texture self.fbo1.use() self.fbo1.clear(color_normalized=(1.0, 1.0, 1.0, 1.0)) - + translate = Mat4.from_translation((0, 0, -1.75)) rx = Mat4.from_rotation(self.time, (1, 0, 0)) ry = Mat4.from_rotation(self.time, (0, 1, 0)) diff --git a/arcade/experimental/clock/clock_window.py b/arcade/experimental/clock/clock_window.py index 72580dbb7..22c36926e 100644 --- a/arcade/experimental/clock/clock_window.py +++ b/arcade/experimental/clock/clock_window.py @@ -1005,7 +1005,7 @@ def add_section(self, section, at_index: Optional[int] = None, at_draw_order: Op def clear( self, color: Optional[RGBOrA255] = None, - color_normalized: Optional[RGBOrANormalized] = None, + color_normalized: Optional[RGBOrANormalized] = None, viewport: Optional[Tuple[int, int, int, int]] = None, ): """Clears the window with the configured background color From 0e79597d2da64ef8d5d04fd0f187182517ea84ca Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Sat, 23 Mar 2024 17:10:06 +0100 Subject: [PATCH 3/4] Remove debug prints --- arcade/gl/framebuffer.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/arcade/gl/framebuffer.py b/arcade/gl/framebuffer.py index 67721d6c7..6db91d835 100644 --- a/arcade/gl/framebuffer.py +++ b/arcade/gl/framebuffer.py @@ -397,17 +397,12 @@ def clear( raise ValueError("Color should be a 3 or 4 component tuple") gl.glClearColor(*clear_color) - print("Clearing color buffer with color", clear_color) if self.depth_attachment: - # gl.glClearDepth(depth) + gl.glClearDepth(depth) gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT) - print("Clearing depth buffer") - print("viewport", self.viewport) - print("scissor", self.scissor) else: gl.glClear(gl.GL_COLOR_BUFFER_BIT) - print("Clearing color buffer only") self.scissor = scissor_values From 747a79371a309ae0f3431d1b27e3d39c1ddcaadd Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Sat, 23 Mar 2024 17:43:53 +0100 Subject: [PATCH 4/4] Fix integration tests --- arcade/examples/minimap.py | 2 +- arcade/examples/minimap_camera.py | 2 +- arcade/examples/sections_demo_1.py | 2 +- arcade/examples/sections_demo_2.py | 2 +- arcade/experimental/atlas_render_into.py | 4 ++-- arcade/experimental/lights.py | 2 +- arcade/experimental/sprite_collect_coins_minimap.py | 2 +- arcade/experimental/texture_render_target.py | 2 +- doc/tutorials/raycasting/example.py | 6 +++--- doc/tutorials/shader_inputs/texture_write.py | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/arcade/examples/minimap.py b/arcade/examples/minimap.py index 6478f6526..a0e7f3990 100644 --- a/arcade/examples/minimap.py +++ b/arcade/examples/minimap.py @@ -111,7 +111,7 @@ def setup(self): def update_minimap(self): proj = 0, MAP_WIDTH, 0, MAP_HEIGHT with self.minimap_sprite_list.atlas.render_into(self.minimap_texture, projection=proj) as fbo: - fbo.clear(MINIMAP_BACKGROUND_COLOR) + fbo.clear(color=MINIMAP_BACKGROUND_COLOR) self.wall_list.draw() self.player_sprite.draw() diff --git a/arcade/examples/minimap_camera.py b/arcade/examples/minimap_camera.py index 229bcd373..da484a1fa 100644 --- a/arcade/examples/minimap_camera.py +++ b/arcade/examples/minimap_camera.py @@ -124,7 +124,7 @@ def on_draw(self): # Draw new minimap using the camera self.camera_minimap.use() - self.clear(MINIMAP_BACKGROUND_COLOR) + self.clear(color=MINIMAP_BACKGROUND_COLOR) self.wall_list.draw() self.player_list.draw() diff --git a/arcade/examples/sections_demo_1.py b/arcade/examples/sections_demo_1.py index 39b9e7adf..17f848e31 100644 --- a/arcade/examples/sections_demo_1.py +++ b/arcade/examples/sections_demo_1.py @@ -127,7 +127,7 @@ def __init__(self): def on_draw(self): # clear the screen - self.clear(arcade.color.BEAU_BLUE) + self.clear(color=arcade.color.BEAU_BLUE) # draw a line separating each Section arcade.draw_line(self.window.width / 2, 0, self.window.width / 2, diff --git a/arcade/examples/sections_demo_2.py b/arcade/examples/sections_demo_2.py index c2962f353..4b723acd6 100644 --- a/arcade/examples/sections_demo_2.py +++ b/arcade/examples/sections_demo_2.py @@ -161,7 +161,7 @@ def end_game(self, winner: Player): self.setup() # prepare a new game def on_draw(self): - self.clear(BEAU_BLUE) # clear the screen + self.clear(color=BEAU_BLUE) # clear the screen self.ball.draw() # draw the ball diff --git a/arcade/experimental/atlas_render_into.py b/arcade/experimental/atlas_render_into.py index c43919f9d..d2b1e8482 100644 --- a/arcade/experimental/atlas_render_into.py +++ b/arcade/experimental/atlas_render_into.py @@ -32,12 +32,12 @@ def on_draw(self): def render_into_sprite_texture(self): # Render shape into texture atlas in the first sprite texture's space with self.spritelist.atlas.render_into(self.texture_1) as fbo: - fbo.clear((255, 0, 0, 255)) + fbo.clear(color=(255, 0, 0, 255)) arcade.draw_rectangle_filled(128, 128, 160, 160, arcade.color.WHITE, self.elapsed_time * 100) # Render a shape into the second texture in the atlas with self.spritelist.atlas.render_into(self.texture_2) as fbo: - fbo.clear((0, 255, 0, 255)) + fbo.clear(color=(0, 255, 0, 255)) arcade.draw_circle_filled( 128, 128, diff --git a/arcade/experimental/lights.py b/arcade/experimental/lights.py index cbfdbfa47..97305ee85 100644 --- a/arcade/experimental/lights.py +++ b/arcade/experimental/lights.py @@ -154,7 +154,7 @@ def __getitem__(self, i) -> Light: def __enter__(self): self._prev_target = self.ctx.active_framebuffer self._fbo.use() - self._fbo.clear(self._background_color) + self._fbo.clear(color=self._background_color) return self def __exit__(self, exc_type, exc_val, exc_tb): diff --git a/arcade/experimental/sprite_collect_coins_minimap.py b/arcade/experimental/sprite_collect_coins_minimap.py index e670dd634..c4e00d50e 100644 --- a/arcade/experimental/sprite_collect_coins_minimap.py +++ b/arcade/experimental/sprite_collect_coins_minimap.py @@ -106,7 +106,7 @@ def on_draw(self): self.clear() self.offscreen.use() - self.offscreen.clear(arcade.color.AMAZON) + self.offscreen.clear(color=arcade.color.AMAZON) arcade.draw_rectangle_outline(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, diff --git a/arcade/experimental/texture_render_target.py b/arcade/experimental/texture_render_target.py index 4a26d7228..ddee67f49 100644 --- a/arcade/experimental/texture_render_target.py +++ b/arcade/experimental/texture_render_target.py @@ -40,7 +40,7 @@ def texture(self) -> Texture2D: def clear(self): """Clear the texture with the configured background color""" - self._fbo.clear(self._background_color) + self._fbo.clear(color=self._background_color) def set_background_color(self, color: RGBA255): """Set the background color for the light layer""" diff --git a/doc/tutorials/raycasting/example.py b/doc/tutorials/raycasting/example.py index 404b8fad6..f6d7f0ebe 100644 --- a/doc/tutorials/raycasting/example.py +++ b/doc/tutorials/raycasting/example.py @@ -90,12 +90,12 @@ def load_shader(self): def on_draw(self): self.channel0.use() # clear_color = 0, 0, 0, 0 - # self.channel0.clear(clear_color) + # self.channel0.clear(color=clear_color) self.wall_list.draw() self.channel1.use() - # self.channel1.clear(clear_color) - self.channel1.clear(arcade.color.ARMY_GREEN) + # self.channel1.clear(color=clear_color) + self.channel1.clear(color=arcade.color.ARMY_GREEN) self.bomb_list.draw() self.use() diff --git a/doc/tutorials/shader_inputs/texture_write.py b/doc/tutorials/shader_inputs/texture_write.py index e28513960..c6ad51a75 100644 --- a/doc/tutorials/shader_inputs/texture_write.py +++ b/doc/tutorials/shader_inputs/texture_write.py @@ -20,7 +20,7 @@ def __init__(self): self.fbo = self.ctx.framebuffer(color_attachments=[self.tex]) # Put something in the framebuffer to start - self.fbo.clear(arcade.color.ALMOND) + self.fbo.clear(color=arcade.color.ALMOND) with self.fbo: arcade.draw_circle_filled( SCREEN_WIDTH / 2,