Real-Time 3D Graphics with WebGL 2
上QQ阅读APP看书,第一时间看更新

Have a Go: Changing the Square Color

Go to the fragment shader and change the color of your geometry.

Four-Component Color Vector

The format is (red, green, blue, alpha). Alpha is always 1.0 (for now), and the first three arguments are float numbers in the range of  0.0 to 1.0.

Remember to save the file after making the changes in your text editor before opening it in your browser.