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

Have a Go: Rendering Using drawArrays

Our square was defined using drawElements via vertices and indices. Go ahead and render the same square using drawArrays.

Hint

Given that you don't use indices with drawArrays, you won't need an IBO. So, you will need to duplicate vertices to construct this geometry.
Hint

For reference, you can find the source code for this exercise in ch02_02_square-arrays.html.