From 54e752609613a8db8d07a020315182adfe95d613 Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Tue, 12 Nov 2024 21:11:17 +0100 Subject: [PATCH] Tweaks --- arcade/gl/texture_array.py | 10 +++++----- tests/unit/gl/test_gl_texture_array.py | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/arcade/gl/texture_array.py b/arcade/gl/texture_array.py index 3108829ba..f80aa9773 100644 --- a/arcade/gl/texture_array.py +++ b/arcade/gl/texture_array.py @@ -176,7 +176,7 @@ def __init__( gl.glBindTexture(self._target, self._glo) - self._texture_2d(data) + self._texture_2d_array(data) # Only set texture parameters on non-multisample textures if self._samples == 0: @@ -207,14 +207,14 @@ def resize(self, size: tuple[int, int]): self._width, self._height = size - self._texture_2d(None) + self._texture_2d_array(None) def __del__(self): # Intercept garbage collection if we are using Context.gc() if self._ctx.gc_mode == "context_gc" and self._glo.value > 0: self._ctx.objects.append(self) - def _texture_2d(self, data): + def _texture_2d_array(self, data): """Create a 2D texture""" # Start by resolving the texture format try: @@ -884,6 +884,6 @@ def get_handle(self, resident: bool = True) -> int: return handle def __repr__(self) -> str: - return "".format( - self._glo.value, self._width, self._height, self._components + return "".format( + self._glo.value, self._width, self._layers, self._height, self._components ) diff --git a/tests/unit/gl/test_gl_texture_array.py b/tests/unit/gl/test_gl_texture_array.py index 5d5a3872e..f4d94dea4 100644 --- a/tests/unit/gl/test_gl_texture_array.py +++ b/tests/unit/gl/test_gl_texture_array.py @@ -45,3 +45,8 @@ def test_create_individual_layers(ctx: arcade.ArcadeContext): ta.write(layer_4, viewport=(0, 0, 3, 4, 4)) assert ta.read() == layers.tobytes() + +def test_repr(ctx: arcade.ArcadeContext): + ta = ctx.texture_array((2, 4, 6), components=1, dtype="f1") + assert repr(ta).startswith("