Logo
Pattern

Discover published sets by community

Explore tens of thousands of sets crafted by our community.

WebGL Essentials

25

Flashcards

0/25

Still learning
StarStarStarStar

gl.clearColor(r, g, b, a)

StarStarStarStar

Sets the color values used when clearing color buffers, where r, g, b, and a represent the red, green, blue and alpha values used for the clear operation.

StarStarStarStar

gl.useProgram(program)

StarStarStarStar

Sets the specified compiled and linked WebGLProgram as the active program for rendering.

StarStarStarStar

gl.enableVertexAttribArray(index)

StarStarStarStar

Enables a generic vertex attribute array. `index` is the position of the attribute array to enable, as obtained from `gl.getAttribLocation()`.

StarStarStarStar

gl.bindTexture(target, texture)

StarStarStarStar

Binds a given WebGLTexture to a texture target. The `target` is often `gl.TEXTURE_2D`. The `texture` is the WebGLTexture to bind.

StarStarStarStar

gl.vertexAttribPointer(index, size, type, normalized, stride, offset)

StarStarStarStar

Defines an array of generic vertex attribute data. Parameters configure the data format and the location and the memory layout of the vertex attributes in the buffer.

StarStarStarStar

gl.activeTexture(texture)

StarStarStarStar

Activates a texture unit. `texture` must be one of `gl.TEXTURE0` to `gl.TEXTURE31`. Subsequent texture operations will affect the active texture unit.

StarStarStarStar

gl.shaderSource(shader, source)

StarStarStarStar

Sets the source code in a shader object. `shader` is the shader object to update, and `source` is a string containing the GLSL source code.

StarStarStarStar

gl.createProgram()

StarStarStarStar

Creates and initializes a WebGLProgram object that shaders can be attached to.

StarStarStarStar

gl.getUniformLocation(program, name)

StarStarStarStar

Returns the location of a uniform variable within a WebGLProgram. `program` is the program object containing the shader with the uniform variable, and `name` is the name of the uniform variable in the GLSL shader code.

StarStarStarStar

gl.texParameteri(target, pname, param)

StarStarStarStar

Sets texture parameters. `target` specifies the texture target, `pname` is the parameter to set, and `param` is the value to set for that parameter.

StarStarStarStar

gl.clear(mask)

StarStarStarStar

Clears buffers to preset values specified by the mask. The mask can be `gl.COLOR_BUFFER_BIT`, `gl.DEPTH_BUFFER_BIT`, or `gl.STENCIL_BUFFER_BIT`.

StarStarStarStar

gl.texImage2D(target, level, internalformat, width, height, border, format, type, pixels)

StarStarStarStar

Defines a two-dimensional texture image. Parameters allow specification of the texture's target, mipmap level, internal format, size, border, format, data type, and the image data itself.

StarStarStarStar

gl.getAttribLocation(program, name)

StarStarStarStar

Returns the location of an attribute variable in a given WebGLProgram. `program` is the program object, and `name` is the name of the attribute variable in the GLSL shader code.

StarStarStarStar

gl.disableVertexAttribArray(index)

StarStarStarStar

Disables a generic vertex attribute array. `index` is the position of the attribute array to disable.

StarStarStarStar

gl.createBuffer()

StarStarStarStar

Creates a new instance of `WebGLBuffer`. This buffer can store vertex data, such as vertex coordinates, texture coordinate data, or vertex color data.

StarStarStarStar

gl.drawArrays(mode, first, count)

StarStarStarStar

Renders primitives from array data. The mode specifies the type of primitive to render, `first` is the starting index, and `count` is the number of indices to render.

StarStarStarStar

gl.createShader(type)

StarStarStarStar

Creates a shader object of a specified type, either `gl.VERTEX_SHADER` or `gl.FRAGMENT_SHADER`, to be used in a WebGL program.

StarStarStarStar

gl.bufferData(target, sizeOrData, usage)

StarStarStarStar

Creates and initializes the buffer object's data store. `target` is the buffer bind point, `sizeOrData` is the data store size or data in ArrayBuffer, and `usage` specifies the intended usage pattern of the data store.

StarStarStarStar

gl.compileShader(shader)

StarStarStarStar

Compiles the shader source code into a form that can be executed by the WebGL system. `shader` is the shader object to compile.

StarStarStarStar

gl.uniformMatrix4fv(location, transpose, value)

StarStarStarStar

Specifies matrix values for uniform variables. `location` indicates the uniform variable location, `transpose` indicates if the matrix should be transposed, and `value` is an array or typed array of `16` float values.

StarStarStarStar

gl.bindBuffer(target, buffer)

StarStarStarStar

Binds a given WebGLBuffer to a buffer target. The `target` can be either `gl.ARRAY_BUFFER` for vertex attributes or `gl.ELEMENT_ARRAY_BUFFER` for element indices.

StarStarStarStar

gl.deleteBuffer(buffer)

StarStarStarStar

Deletes a buffer object, freeing the memory. `buffer` is a WebGLBuffer to be deleted.

StarStarStarStar

gl.viewport(x, y, width, height)

StarStarStarStar

Sets the viewport, specifying the affine transformation of x and y from normalized device coordinates to window coordinates. This affects how the rendered image is scaled and translated into the canvas.

StarStarStarStar

gl.attachShader(program, shader)

StarStarStarStar

Attaches a compiled shader object to a WebGLProgram. `program` is the program to attach to, and `shader` is the shader object.

StarStarStarStar

gl.linkProgram(program)

StarStarStarStar

Links all attached shaders in a WebGLProgram into a final program that can be used for rendering.

Know
0
Still learning
Click to flip
Know
0
Logo

© Hypatia.Tech. 2024 All rights reserved.