I have an array of values from a Cellular Automata simulation (640x480 grid) that I would like to draw straight to screen. My understanding is that these are the only options available:
So... how can I draw/blit all that 2D pixel data the fastest way possible?
ANY trick, option or alternative would be most welcome. Thanks in advance.
asked May 07 '10 at 01:55 PM
A little more advanced, but you could also rewrite the cellular automata simulation to evaluate inside a shader. This would be done by applying the shader on a fullscreen quad. If you need information about the previous state of the cells when evaluating, you could this by making two rendertexture's and ping-pong between the two. Something like this:
---- Next frame ----
If you can't fit all the information into one texture, you can always use more of these ping-pong's. This technique would definitely speed up your calculations quite a bit, given they are applicable to this kind of parallel processing.
answered May 08 '10 at 04:16 PM
It is actually possible, on OSX, to blit textures very fast by having a plugin access the OpenGL texture "handle", and write the data directly from there.
This has been used successfully for putting high-resolution quicktime movies into Unity.
The big issue is that it doesn't work on Windows, because Unity is using Direct3D there, and it appears to be quite complex to update D3D textures from plugins. Any ideas or pointers welcome.
answered Aug 17 '10 at 12:01 PM
You could divide that into a grid of smaller textures, and then update only the textures that actually change.
answered May 07 '10 at 04:27 PM
i'd just use your first idea and update the texture every 0.1s or so in a coroutine - it should still look plenty good enough without killing your frame rate
answered May 07 '10 at 02:22 PM
Write a shader!
answered May 22 '10 at 04:39 PM