Lines Matching refs:shader
15 …shader program, also known as WebGL program, is a JavaScript object responsible for associating th…
23 - The vertex shader is mainly used to receive the coordinates of a point in a 3D space, convert the…
25 - The fragment shader is mainly used to output a color value for each pixel being processed.
29 … in a 2D space output by the vertex shader into pixels to be processed and passing the pixels to t…
69 …tring): GLint | Obtains the address of the **attribute** variable in the shader from the given Web…
114 3. Define the vertex shader.
116 …The vertex shader needs to perform the necessary transformation (for example, adjustment or calcul…
129 4. Define the fragment shader.
131 …After the vertex shader processes the vertices, the fragment shader is called once by each pixel t…
140 5. Pass the shader to WebGL.
142 Pass the vertex shader and fragment shader defined to WebGL and compile them together.
144 …to transfer the type and source for the shader. In this example, two shaders are created and attac…
147 // Initialize the shader program so that WebGL knows how to draw data.
151 // Create a shader program.
159 "Unable to initialize the shader program: "+
166 // Create a shader of the specified type, upload the source code, and compile the source code.
168 const shader = gl.createShader(type);
169 // Send the resource to the shader object.
170 gl.shaderSource(shader, source);
171 // Compile the shader program.
172 gl.compileShader(shader);
174 if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
176 "Error occurred when compiling the shader: "+ gl.getShaderInfoLog (shader),
178 gl.deleteShader(shader);
181 return shader;
186 …- After creating the shader program, find the input location allocated by WebGL. There is one prop…
188 …- The property value is assigned by the buffer. For each iteration of the vertex shader, a new val…
190 …y use the same value in all iterations of the shader. Because the property location is specific to…