png 20 30 gray.png position 4 -1 -2 -3 4 1 3.5 3 4 2 0 0 2 -1 0.5 0 1 # viewport and division by double moves (x,y,z,w) to ((x/w+1)*width/2, (y/w+1)*height/2) # meaning we have xy positions (7.5,7.5) and (12.5, 28.125) and (20,15) and (0,22.5) color 3 1 1 1 1 1 1 0 0 0 0 0 0 drawArraysTriangles 0 3 # y=8, x from 7.621... (rgb=1) to 8.333... (rgb=0.933...) # y=9, x from 7.863... (rgb=1) to 10 (rgb=0.8) # y=10, x from 8.106... (rgb=1) to 11.666... (rgb=0.666...) # ... and so on until reach mid-height vertex # y=15, x from 9.318... (rgb=1) to 20 (rgb=0) # y=16, x from 9.560... (rgb=1) to 19.428... (rgb=0.076...) # ... drawArraysTriangles 1 3 # last draw goes on top of first draw (because no depth buffer)