Search notes:

WebGL

WebGL is a JavaScript port of the OpenGL ES 2.0 graphics library which makes it possible for web pages to compute a graphic on a device's GPU and render the result in a <canvas> HTML element.
WebGL is part of the Web platform.

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

Successor of WebGL: WebGPU

WebGL focuses on drawing graphics. Because since the inception of WebGL, the need to use a GPU for other tasks («general purpose GPU» or GPGPU) has increased, a successor of WebGL was created: the WebGPU API.

See also

Minimalist example, draw points
Clip space
OpenGL ES Shading Language
The HTML <canvas> element.
web

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1741107181, '18.222.106.87', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/web/WebGL/index(127): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78