Search notes:

WebGL

WebGL program

A WebGL programm is created with program = gl.createProgram().
A WebGL programm needs two shaders: a vertex shader and a fragment shader.

Shader

Shaders can be thought of as functions of the program that run on the GPU. They are written in a language called Graphic Library Shader Language.
There are two types of shaders:
In JavaScript, a shader is created with shader = gl.createShader().
The source code for a shader is indicated with gl.shaderSource(shader, source_code).
Then the shader is compiled with gl.compileShader(shader)).
Finally, the shaders are added to the gl-program with gl.attachShaders(gl_program, shader).

Vertex Buffer Object

Abbreviated with VBO.

Determining if WebGL is supported

If a browser supports WebGL can be determined by checking for the existance of window.WebGLRenderingContext with JavaScript.
<!DOCTYPE html>
<html>
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Does the browser support webgl?</title>

  <script type="application/x-javascript">
  function main() {
     var result = document.getElementById('result');
     if (window.WebGLRenderingContext) {
        result.innerHTML = "Browser supports WebGl";
     }
     else {
        result.innerHTML = "Browser does not suppoert WebGl";
     }
  }
  window.onload = main;
  </script>

</head>

<body onload='main()'>
  <div id='result'></div>
</body>

</html>
Github repository about-WebGL, path: /does-browser-support-webgl.html

See also

Minimalist example, draw points
Clip space
OpenGL ES Shading Language
The HTML <canvas> element.
web
WebGL is part of the Web platform.

Index