Summary

In this chapter, we have discussed how WebGL renders geometry. Remember that there are two kinds of WebGL buffers that deal with geometry rendering: VBOs and IBOs.

WebGL's rendering pipeline describes how the WebGL buffers are used and passed in the form of attributes to be processed by the vertex shader. The vertex shader parallelizes vertex processing in the GPU. Vertices define the surface of the geometry that is going to be rendered. Every element on this surface is known as a fragment. These fragments are processed by the fragment shader. Fragment processing also occurs in parallel in the GPU. When all the fragments have been processed, the framebuffer, a two-dimensional array, contains the image that is then displayed on your screen.

WebGL works as a state machine. As such, properties referring to buffers are available and their values will be dependent on the buffer currently bound.

We also saw that JSON and AJAX are two JavaScript technologies that integrate really well with WebGL, enabling us to load really complex geometries without having to specify them inside our webpage.

In the next chapter, we will learn more about the vertex and fragment shaders and we will see how we can use them to implement light sources in our WebGL scene.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.142.146