2019년 2월 3일 일요일

godot paint image on the fly

setup
onready var sprite = $BackgroundSceneRoot/Sprite


func _ready():
    img = Image.new()
    img.create(Globals.WIDTH, Globals.HEIGHT, false, Image.FORMAT_RGB8)
    tex = ImageTexture.new()
    tex.create_from_image(img, 0)

    sprite.texture = tex

update
    img.lock()
    img.set_pixel(x, y, Color(r, g, b))
    img.unlock()

    sprite.texture.set_data(img)

댓글 없음:

댓글 쓰기

via permission error linux chrome

 https://bbs.archlinux.org/viewtopic.php?id=285709