Skip to main content

What is WebGL?

What is WebGL? 

WebGL is derived from OpenGL. OpenGL is a programming interface residing in your graphics processing unit ("graphics card" or GPU) that allows a graphics programmer to write programs that create and manipulate graphics. Essentially, WebGL allows you to display 3D graphics on a 2D surface through a series of transformations called the graphics pipeline. This process is called rendering. Older graphics cards employed a fixed-function pipeline that was not programmable while today's GPUs employ a programmable pipeline.

OpenGL is used in computer-aided design (CAD), virtual reality, scientific visualization, information visualization, flight simulation, and video games. It is maintained and developed by the non-profit technology consortium Khronos Group.

WebGL is a version of OpenGL that runs in a web browser. WebGL is based on the OpenGL ES version of OpenGL that is targeted at embedded devices. In devices without OpenGL drivers, there is a way to run WebGL programs using Direct3D.  Direct3D is a graphics rendering programming interface which is available in all Windows desktop systems. WebGL makes use of Direct3D drivers by using the Almost Native Graphics Layer Engine, or ANGLE for short. ANGLE's objective is to use Direct3D drivers to access OpenGL  GPU functions where insufficient native OpenGL drivers exists. ANGLE is a Windows solution. On MacOS and Linux/Unix when OpenGL is well supported, OpenGL is the preferred route to execute WebGL programs.

OpenGL ES is a version of OpenGL intended for devices such as mobile phones, tablets, game consoles, appliances and vehicles. While OpenGL has an associated language called OpenGL Shading Language (GLSL), OpenGL ES uses the OpenGL ES Shading Language. The "ES" means Embedded Systems but it is difficult to conceive of today's mobile phones and tablets as embedded systems. However appliances such as refrigerators and vehicles are embedded systems. 

Versions of OpenGL ES exist ranging from 1.0 to 3.2. Version 1.0 supported so-called fixed-function graphics pipelines while 2.0 onwards support programmable graphics pipelines found in modern GPUs. "Fixed" implies that the pipeline is a fixed set of processed hardwired into the GPU while programmable implies the graphics pipeline processes can be controlled and customised via software.

A WebGL program consists of OpenGL ES statements hosted within Javascript code inside a web page. The graphics are generated in an HTML <canvas> element.

In the following blog posts, we shall look at the structure of a WebGL program

Comments

Popular posts from this blog

Welcome

I am a computer science teacher who often deals with topics that are almost mystical when first encountered yet need to be taught effectively in a few hours.  My principles of teaching are that: There no point of learning stuff that one will never need in their lives.  Only about 20% to 30% of knowledge required to acquire basic proficiency in a particular sub-discipline of computing can be taught in class. The learner must learn the rest on their own. For one to use the knowledge provided, there must be a certain level of grasp that involves understanding the structure and purpose of the content. The learner needs to develop a systematic process of designing and implementing projects that is likely to lead to success. Success involves meeting the standards set by the relevant regulatory or professional body as well as the needs of the client and the standards of excellence of the system engineers responsible for executing the project. The first and second princip...