October 2018
Intermediate to advanced
500 pages
12h 40m
English
Let's refactor a previous example using VAOs:
// Global variables that are set and used// across the applicationlet gl, program, squareVAO, squareIndexBuffer, indices;
// Set up the buffers for the squarefunction initBuffers() { /* V0 V3 (-0.5, 0.5, 0) (0.5, 0.5, 0) X---------------------X | | | | | (0, 0) | | | | | X---------------------X V1 V2 (-0.5, -0.5, 0) (0.5, -0.5, 0) */ const vertices = [ -0.5, 0.5, 0, -0.5, -0.5, 0, 0.5, -0.5, 0,