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

Advanced Geometry-Loading Techniques

So far, we’ve rendered very simple objects. Now, let's investigate how to load a geometry (vertices and indices) from a file instead of declaring the vertices and indices every time we call initBuffers. To do this, we will make asynchronous calls to the web server using AJAX. We will retrieve the file with our geometry from the web server and then use the built-in JSON parser to convert the context of our files into JavaScript objects. In our case, these objects will be the vertices and indices arrays.

本周热推: