code
import taichi as ti
ti.init(arch=ti.cpu)
width = 1024
height = 1024
offset_x = -512
offset_y = -512
pixels = ti.Vector.field(4, dtype=ti.f32, shape=(width, height), offset=(offset_x, offset_y))
# pixels = ti.Vector.field(4, dtype=ti.f32, shape=(width, height))
@ti.kernel
def clear_buffer():
for i, j in pixels:
pixels[i, j] = ti.Vector([1.0, 1.0, 1.0, 1.0]);
gui = ti.GUI("DDA", (width, height))
while gui.running:
clear_buffer()
gui.set_image(pixels)
gui.show()
gui出来了,然后报错。
error message:
(taichi) ➜ KLD ./main.py
[Taichi] version 0.8.11, llvm 10.0.0, commit 9d0973e5, osx, python 3.9.7
[Taichi] Starting on arch=x64
python(6790,0x10e32b600) malloc: Region cookie corrupted for region 0x7fbd72800000 (value is 3f800000)[0x7fbd728081fc]
python(6790,0x10e32b600) malloc: *** set a breakpoint in malloc_error_break to debug
[E 02/08/22 18:23:46.334 624756] Received signal 6 (Abort trap: 6)
而且效果为什么不是全白的?