Skip to content

Commit

Permalink
blender: Specify 32-bit floats for memory view
Browse files Browse the repository at this point in the history
It seems to default to doubles, but the buffer has floats, so specify
that.
  • Loading branch information
vkoskiv committed Jan 2, 2024
1 parent 300d499 commit 1e427f8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bindings/blender_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 1e427f8

Please sign in to comment.