From 1e427f8fdfd22e0d700a71bab88033b16c80a1bd Mon Sep 17 00:00:00 2001 From: Valtteri Koskivuori Date: Tue, 2 Jan 2024 21:48:11 +0200 Subject: [PATCH] blender: Specify 32-bit floats for memory view It seems to default to doubles, but the buffer has floats, so specify that. --- bindings/blender_init.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/blender_init.py b/bindings/blender_init.py index c9709553..6ce64f52 100644 --- a/bindings/blender_init.py +++ b/bindings/blender_init.py @@ -440,8 +440,8 @@ def __init__(self, dimensions, bitmap): float_count = self.bitmap.width * self.bitmap.height * self.bitmap.stride buffer_from_memory = ct.pythonapi.PyMemoryView_FromMemory buffer_from_memory.restype = ct.py_object - buffer = buffer_from_memory(self.bitmap.data.float_ptr, 8 * float_count) - pixels = np.frombuffer(buffer, float) + buffer = buffer_from_memory(self.bitmap.data.float_ptr, 4 * float_count) + pixels = np.frombuffer(buffer, np.float32) self.pixels = gpu.types.Buffer('FLOAT', float_count, pixels) def __del__(self):