Page 1 of 1

Dynamically updating textures -- possible?

Posted: Mon Jul 24, 2017 11:16 am
by Gez
As far as I understand the GLDEFS shaders, they're read-only, in that they can't update the source image. I'd like to (try to) make something that continually updates a texture, something like say, Conway's game of life. Is it possible?

If not with shaders, is it possible with ZScript?

Re: Dynamically updating textures -- possible?

Posted: Mon Jul 24, 2017 11:22 am
by Rachael
This will likely require being able to give fragment shaders write access to a texture, directly.

I would wait until Vulkan support is more mature - Graf has made it clear that he wants to wait to do more generalized shader improvements until then.

Re: Dynamically updating textures -- possible?

Posted: Mon Jul 24, 2017 1:41 pm
by Graf Zahl
Writing to a texture with a shader is certainly possible - but it's not this simple. It will require a similar setup like the camera textures or the postprocessing effects that set up a texture as a render target.
The input textures to a shader are immutable objects and cannot be modified.

This also needs to run outside of the main shader, of course.