For example, if x = 2, y =17 and x=17, y =2, you'd be getting always the same colour, but you clearly don't want that.
No, it's right. I wanted to see if I can get everything to be painted white before I make the next big step (adding the array). That's why I wrote (stupid nonsense example of what I tried follows)
But I even failed this simple test. :?
No, I know you wanted everything white, what I'm saying is that x*y doesn't uniquely identify one pixel, so it
can't be right. Do what I said and then Laurent repeated: 4(800*y+x) and then that plus 1, 2, and 3. Notice that uniquely identifies each pixel, in the sense that if you have a number n = 800*y+x, there are no two different x and y that give that n.
Xorlium