|
Hello all, 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.
(comments are locked)
|
|
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. A double buffered shader using render textures to avoid Apply(). How cool. Would you have an example of this being used by any chance ?
May 09 '10 at 04:06 AM
BlobbyPops
(comments are locked)
|
|
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. Update: you can force Windows to use OpenGL with a command-line param
Sep 13 '11 at 11:20 PM
DaveA
(comments are locked)
|
|
You could divide that into a grid of smaller textures, and then update only the textures that actually change. So you reckon that there's no faster way to blit than having to go through a texture Update?
May 07 '10 at 11:49 PM
BlobbyPops
@BlobbyPops: I can't think of a way, no.
May 08 '10 at 12:12 AM
Eric5h5
(comments are locked)
|
|
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 Hi Mike, thanks for your reply. Unfortunately a coroutine is not a thread and it would actually block the graphics pipeline as the texture needs to be uploaded. Also 0.1s would only make 10fps and the point of my question was to get a maximum framerate.
May 07 '10 at 03:09 PM
BlobbyPops
Indeed - you can't Apply from a thread without thread errors being spammed back at you. If the texture is the only thing you're interested in drawing, then yes, 10 fps probably won't be much good; i assumed you were trying to keep a decent framerate for other things while you drew this :)
May 07 '10 at 03:38 PM
Mike 3
(comments are locked)
|
|
Write a shader! good answer! "MASSIVE SARCASM QUOTES"
Mar 21 at 04:11 AM
Benproductions1
(comments are locked)
|
