![]() |
VOOZH | about |
Creating interactive media content for the web traditionally required third-party apps or plug-ins installed in browsers. With the rise of open web standards and the need to support native graphics capabilities in the web browsers, WebGL was born to bring cross-browser compatibility and to be fully integrated with web standards.
WebGL (Web Graphics Library) is a rasterization API based on OpenGL ES developed by the Khronos Group, Inc. for rendering 2D and 3D graphics in a web browser. WebGL uses hardware acceleration which enables developers the ability to build high-performance real-time rendering interactive graphics in the web browser such as games, simulations, data visualization, animated videos, 3D modeling, molecular animations, and much more.
The efficiency of WebGL is perhaps one of the main advantages as it allows high-demanding power web applications to extract the full capabilities of the graphics card. Moreover, WebGL is plugin-free and is compatible with all major browsers, so users donβt need to worry about downloading or installing any external application to run a WebGL app.
A WebGL program comprises codes written in OpenGL Shading Language (GLSL), JavaScript, and HTML5. GLSL is used to write the shaders, and special programs executed on the graphics hardware that computes attributes like vertices, textures, colors, lightning, and so on during the rendering of the object or scene. GLSL gives developers important control over the graphic pipeline. JavaScript and HTML are used primarily as binding languages and to provide a rendering context.
A WebGL program is commonly generated by multiple draws on the canvas HTML element that are carried out by the graphic processing unit (GPU) through a process called the rendering pipeline.
To create high-fidelity graphics, WebGL may be quite complex to use as it is nearly low-level programming.
There is, however, a variety of libraries available that abstract some of the difficulties of WebGL making them less verbose such as twgl, Three.js, PhiloGL, and J3D.
The rendering pipeline consists of a sequence of operations required each time an object (the 2D/3D scene) is rendered on the screen. The objective is to draw the desired graphic model or scene from primitives (geometric shapes expressed by their Cartesian coordinates X, Y, and Z). In computer graphics, each object is modeled from a collection of triangles. So, in the depicted diagram, we are rendering just one triangle and all these phases represent the rendering pipeline.
OpenGL (API, Used Technology): As mentioned earlier WebGL is based on OpenGL and its syntax is similar. There are, however, different versions and standards of OpenGL. Currently, there are three standards: OpenGL for desktop applications, OpenGL ES (Embedded Systems) used primarily in smartphones and tablets, and WebGL which is based on OpenGL ES specification for browsers.
WebGL 1.0 is equivalent to OpenGL ES 2.0
WebGL 2.0 is equivalent to OpenGL ES 3.0
Browsers Support:
WebGL 2.0 is widely supported in all major browsers on both desktop and mobile Apple (Safari), Google (Chrome), Microsoft (Edge), Opera (Opera web browser), and Mozilla (Firefox). However, as WebGL is running on the graphic card, its availability also requires hardware with OpenGL feature support.