The document is a transcript from a presentation on WebGL and shaders. It introduces WebGL and explains that it uses shaders written in GLSL to render 3D graphics in the browser. It discusses the core WebGL concepts of vertices, buffers to store vertex data on the GPU, and vertex and fragment shaders. It explains that vertices are processed by vertex shaders and fragments are processed by fragment shaders. The presenter then demonstrates how to write simple shaders and defines the different types of variables that can be used in shaders.
23. @g33konaut
A buffer moves the data to the GPU memory
// create an empty buffer
const vBuf = gl.createBuffer();
24. @g33konaut
A buffer moves the data to the GPU memory
// create an empty buffer
const vBuf = gl.createBuffer();
// select vBuf as the current ARRAY_BUFFER
gl.bindBuffer(gl.ARRAY_BUFFER, vBuf);
25. @g33konaut
A buffer moves the data to the GPU memory
// create an empty buffer
const vBuf = gl.createBuffer();
// select vBuf as the current ARRAY_BUFFER
gl.bindBuffer(gl.ARRAY_BUFFER, vBuf);
// copy the TypedArray into the buffer
gl.bufferData(gl.ARRAY_BUFFER, vrtx, gl.STATIC_DRAW);
35. @g33konaut
The 4 types of inputs for shaders
● const A constant
● uniform A “global” variable
36. @g33konaut
The 4 types of inputs for shaders
● const A constant
● uniform A “global” variable
● attribute A per-vertex variable
37. @g33konaut
The 4 types of inputs for shaders
● const A constant
● uniform A “global” variable
● attribute A per-vertex variable
● varying Interpolated variable
(vertex write, fragment read)