I have a program (slime mold simulation) that generates a big 2d array of values. I want to draw this matrix to the screen in real time. I see a lot of solutions that can make a image from a 2d array, but those are not fast enough to get a reasonable fps at a HD resolution (1920×1080 for example).
At the moment I use Allegro 5, as that is the only visualization library that I know how to use (and the only one that I know of that is easily installed using Nuget). I often have a lot of problems getting c++ libraries to work because I always just use Nuget (all linking stuff is hard okay).
By drawing to a locked bitmap and skipping black pixels I can squeeze some performance out of that, but at a quarter of a million particles the draw time is still just as long as the (unoptimized) simulation time (63291 ms).
At the moment I’m doing the preprocessing of the pixels (scaling, making pretty colors) by hand in in CUDA, which wasn’t that hard because i’m doing the simulation using CUDA anyway.
Allegro has access to fragment shaders, but the documentation is difficult for me to understand as I don’t know a lot of the stuff going on there. This means that if there is an easier option, I’d rather not mess with that.
I know there are a couple options for me out there, but before I go out of my way to learn a completely new library or something like that I would like to know the best library for this project, as I don’t have that much free time to program.
Long story short, my question is:
what is the quickest way to draw a 2D array to the screen in real time?
Example of output now (saved frames and stitched together for video):
Source: Windows Questions C++