Good day, dear colleagues.
Please help me with solving one trivial problem.
There is a two-dimensional array of a certain size, filled randomly with zeros and ones. Assume that the size of the array is 1280 by 720 cells. And the screen/window size is the same.
It is required to draw each cell (number) from this array in a certain color (0 - white, 1 - black).
I know how to do this using a loop and drawRect; I know that it is possible to set each pixel of an Image in a loop, put an Image in a texture and draw - but these solutions are slow.
Therefore, I would like to find out how this can be done using a shader.
I understand the basic principles of shaders. However, I could not figure out how to get the coordinates of the current pixel of the screen in the shader program and get the value of the corresponding cell from the array from the position of this pixel (index the array) - this is the only moment that is incomprehensible to me.
I will be very grateful for your help.