Represent 2D array in opengl 4.5

696 views Asked by At

Let's imagine such array:

[0,0,0,1,1,0,0,0]
[0,0,1,0,0,1,0,0]
[0,1,0,0,0,0,1,0]
[0,1,0,0,0,0,1,0]
[0,0,1,0,0,1,0,0]
[0,0,0,1,1,0,0,0]

Since this array is of size 8x6, I'd like to divide the width of my window by 8, and height by 6, and then represent every '1' in the array as some color rectangle and every '0' as nothing (background color). Just like in this example (without split lines, of course):

picture

I was able to draw everything I wanted, only missing thing was to how to split my window accordingly and draw bigger boxes. Then, I found out that I'm using old OpenGL API.

I'm looking for the answer to these questions:

  1. Is this really so hard or am I missing some very important points here?
  2. What OpenGL 4 features should I know, to be able to do what I've explained?
  3. Are you aware of some docs/tutorials/books in C (I simply don't know/like C++), which covers such or similar examples for OGL4 (or at least OGL3)?
0

There are 0 answers