WebGL experiment part 2, Adding colour
Part 2 ! OMG !
This is a very small update, and we are going to draw this:
(image from NeHe website)
The demo page is here and the code is here.
We are using the code from experiment01.
We are just adding the colors in our
var colors = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ];
Then, we load them into the mesh:
That’s it !
Same thing here. Adding:
var colors = [ 0.5, 0.5, 1, 0.5, 0.5, 1, 0.5, 0.5, 1, 0.5, 0.5, 1 ];
I don’t know yet how to not repeat the color for the square… Do you have an idea ?
See you on part 3 !