Online Book Reader

Home Category

HTML5 Canvas [214]

By Root 6559 0
cubeVertexIndexBuffer.numItems,

webGLContext.UNSIGNED_SHORT, 0);

mvPopMatrix();

Finally, we increase the rotateCube variable so that the next time drawScreen() is called, the cube will be updated with a new angle. The code below adds 2 degrees to the rotation angle each time drawScreen() is called:

rotateCube += 2;

}

Full Code Listing


Example 11-1 gives the full code listing for CH11EX1.html. Notice that many of the code styles and constructs we have used over the past 10 chapters are still in place in this application. Besides the obvious inclusion of code related directly to WebGL, this application operates essentially the same way as the other apps we discussed in this book.

Example 11-1. WebGL test

CH11EX1: WebGL Test