Rendering

Let's take a step back to take a look at the big picture. We mentioned before that in our architecture we have defined three main functions that define the lifecycle of our WebGL application. These functions are: configure, load, and render.

Up to this point, we have set up the scene writing the code for the configure function. After that, we have created our JSON cars and loaded them by writing the code for the load function. Now, we will implement the code for the third function: the render function.

The code is pretty standard and almost identical to the draw/render functions that we have written in previous chapters. As we can see in the following diagram, we set and clear the area that we are going to draw on, then we check on the ...

Get WebGL Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.