Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/gluten/src/webgl/mod.ts>WebGLRenderingContext

OpenGL bindings & WebGL API implementation for Deno.
Latest
class WebGLRenderingContext
import { WebGLRenderingContext } from "https://deno.land/x/gluten@0.1.9/src/webgl/mod.ts";

Provides an interface to the OpenGL ES 2.0 graphics rendering context for the drawing surface of a dwm window.

Constructors

new
WebGLRenderingContext(window: DwmWindow, attributes?: WebGLContextAttributes)

Properties

ACTIVE_ATTRIBUTES: number
ACTIVE_TEXTURE: number
ACTIVE_UNIFORMS: number
ALIASED_LINE_WIDTH_RANGE: number
ALIASED_POINT_SIZE_RANGE: number
ALPHA: number
ALPHA_BITS: number
ALWAYS: number
ARRAY_BUFFER: number
ARRAY_BUFFER_BINDING: number
ATTACHED_SHADERS: number
BACK: number
BLEND: number
BLEND_COLOR: number
BLEND_DST_ALPHA: number
BLEND_DST_RGB: number
BLEND_EQUATION: number
BLEND_EQUATION_ALPHA: number
BLEND_EQUATION_RGB: number
BLEND_SRC_ALPHA: number
BLEND_SRC_RGB: number
BLUE_BITS: number
BOOL: number
BOOL_VEC2: number
BOOL_VEC3: number
BOOL_VEC4: number
BROWSER_DEFAULT_WEBGL: number
BUFFER_SIZE: number
BUFFER_USAGE: number
BYTE: number
CCW: number
CLAMP_TO_EDGE: number
COLOR_ATTACHMENT0: number
COLOR_BUFFER_BIT: number
COLOR_CLEAR_VALUE: number
COLOR_WRITEMASK: number
COMPILE_STATUS: number
COMPRESSED_TEXTURE_FORMATS: number
CONSTANT_ALPHA: number
CONSTANT_COLOR: number
CONTEXT_LOST_WEBGL: number
CULL_FACE: number
CULL_FACE_MODE: number
CURRENT_PROGRAM: number
CURRENT_VERTEX_ATTRIB: number
CW: number
DECR: number
DECR_WRAP: number
DELETE_STATUS: number
DEPTH_ATTACHMENT: number
DEPTH_BITS: number
DEPTH_BUFFER_BIT: number
DEPTH_CLEAR_VALUE: number
DEPTH_COMPONENT: number
DEPTH_COMPONENT16: number
DEPTH_FUNC: number
DEPTH_RANGE: number
DEPTH_STENCIL: number
DEPTH_STENCIL_ATTACHMENT: number
DEPTH_TEST: number
DEPTH_WRITEMASK: number
DEPTH24_STENCIL8: number
DITHER: number
DONT_CARE: number
readonly
drawingBufferHeight: number

Represents the actual height of the current drawing buffer. It should match the height attribute of the window associated with this context, but might differ if the implementation is not able to provide the requested height.

readonly
drawingBufferWidth: number

Represents the actual width of the current drawing buffer. It should match the width attribute of the window associated with this context, but might differ if the implementation is not able to provide the requested width.

DST_ALPHA: number
DST_COLOR: number
DYNAMIC_DRAW: number
ELEMENT_ARRAY_BUFFER: number
ELEMENT_ARRAY_BUFFER_BINDING: number
EQUAL: number
FASTEST: number
FLOAT: number
FLOAT_MAT2: number
FLOAT_MAT3: number
FLOAT_MAT4: number
FLOAT_VEC2: number
FLOAT_VEC3: number
FLOAT_VEC4: number
FRAGMENT_SHADER: number
FRAMEBUFFER: number
FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number
FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number
FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number
FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number
FRAMEBUFFER_BINDING: number
FRAMEBUFFER_COMPLETE: number
FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number
FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number
FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number
FRAMEBUFFER_UNSUPPORTED: number
FRONT: number
FRONT_AND_BACK: number
FRONT_FACE: number
FUNC_ADD: number
FUNC_REVERSE_SUBTRACT: number
FUNC_SUBTRACT: number
GENERATE_MIPMAP_HINT: number
GEQUAL: number
GREATER: number
GREEN_BITS: number
HALF_FLOAT_OES: number
HIGH_FLOAT: number
HIGH_INT: number
IMPLEMENTATION_COLOR_READ_FORMAT: number
IMPLEMENTATION_COLOR_READ_TYPE: number
INCR: number
INCR_WRAP: number
INT: number
INT_VEC2: number
INT_VEC3: number
INT_VEC4: number
INVALID_ENUM: number
INVALID_FRAMEBUFFER_OPERATION: number
INVALID_OPERATION: number
INVALID_VALUE: number
INVERT: number
KEEP: number
LEQUAL: number
LESS: number
LINE_LOOP: number
LINE_STRIP: number
LINE_WIDTH: number
LINEAR: number
LINEAR_MIPMAP_LINEAR: number
LINEAR_MIPMAP_NEAREST: number
LINES: number
LOW_FLOAT: number
LOW_INT: number
LUMINANCE: number
LUMINANCE_ALPHA: number
MAX_COMBINED_TEXTURE_IMAGE_UNITS: number
MAX_CUBE_MAP_TEXTURE_SIZE: number
MAX_FRAGMENT_UNIFORM_VECTORS: number
MAX_RENDERBUFFER_SIZE: number
MAX_TEXTURE_IMAGE_UNITS: number
MAX_TEXTURE_SIZE: number
MAX_VARYING_VECTORS: number
MAX_VERTEX_ATTRIBS: number
MAX_VERTEX_TEXTURE_IMAGE_UNITS: number
MAX_VERTEX_UNIFORM_VECTORS: number
MAX_VIEWPORT_DIMS: number
MEDIUM_FLOAT: number
MEDIUM_INT: number
MIRRORED_REPEAT: number
NEAREST: number
NEAREST_MIPMAP_LINEAR: number
NEAREST_MIPMAP_NEAREST: number
NEVER: number
NICEST: number
NO_ERROR: number
NONE: number
NOTEQUAL: number
ONE: number
ONE_MINUS_CONSTANT_ALPHA: number
ONE_MINUS_CONSTANT_COLOR: number
ONE_MINUS_DST_ALPHA: number
ONE_MINUS_DST_COLOR: number
ONE_MINUS_SRC_ALPHA: number
ONE_MINUS_SRC_COLOR: number
OUT_OF_MEMORY: number
PACK_ALIGNMENT: number
POINTS: number
POLYGON_OFFSET_FACTOR: number
POLYGON_OFFSET_FILL: number
POLYGON_OFFSET_UNITS: number
RED_BITS: number
RENDERBUFFER: number
RENDERBUFFER_ALPHA_SIZE: number
RENDERBUFFER_BINDING: number
RENDERBUFFER_BLUE_SIZE: number
RENDERBUFFER_DEPTH_SIZE: number
RENDERBUFFER_GREEN_SIZE: number
RENDERBUFFER_HEIGHT: number
RENDERBUFFER_INTERNAL_FORMAT: number
RENDERBUFFER_RED_SIZE: number
RENDERBUFFER_STENCIL_SIZE: number
RENDERBUFFER_WIDTH: number
RENDERER: number
REPEAT: number
REPLACE: number
RGB: number
RGB5_A1: number
RGB565: number
RGBA: number
RGBA16F: number
RGBA32F: number
RGBA4: number
SAMPLE_ALPHA_TO_COVERAGE: number
SAMPLE_BUFFERS: number
SAMPLE_COVERAGE: number
SAMPLE_COVERAGE_INVERT: number
SAMPLE_COVERAGE_VALUE: number
SAMPLER_2D: number
SAMPLER_CUBE: number
SAMPLES: number
SCISSOR_BOX: number
SCISSOR_TEST: number
SHADER_TYPE: number
SHADING_LANGUAGE_VERSION: number
SHORT: number
SRC_ALPHA: number
SRC_ALPHA_SATURATE: number
SRC_COLOR: number
STATIC_DRAW: number
STENCIL_ATTACHMENT: number
STENCIL_BACK_FAIL: number
STENCIL_BACK_FUNC: number
STENCIL_BACK_PASS_DEPTH_FAIL: number
STENCIL_BACK_PASS_DEPTH_PASS: number
STENCIL_BACK_REF: number
STENCIL_BACK_VALUE_MASK: number
STENCIL_BACK_WRITEMASK: number
STENCIL_BITS: number
STENCIL_BUFFER_BIT: number
STENCIL_CLEAR_VALUE: number
STENCIL_FAIL: number
STENCIL_FUNC: number
STENCIL_INDEX8: number
STENCIL_PASS_DEPTH_FAIL: number
STENCIL_PASS_DEPTH_PASS: number
STENCIL_REF: number
STENCIL_TEST: number
STENCIL_VALUE_MASK: number
STENCIL_WRITEMASK: number
STREAM_DRAW: number
SUBPIXEL_BITS: number
TEXTURE: number
TEXTURE_2D: number
TEXTURE_BINDING_2D: number
TEXTURE_BINDING_CUBE_MAP: number
TEXTURE_CUBE_MAP: number
TEXTURE_CUBE_MAP_NEGATIVE_X: number
TEXTURE_CUBE_MAP_NEGATIVE_Y: number
TEXTURE_CUBE_MAP_NEGATIVE_Z: number
TEXTURE_CUBE_MAP_POSITIVE_X: number
TEXTURE_CUBE_MAP_POSITIVE_Y: number
TEXTURE_CUBE_MAP_POSITIVE_Z: number
TEXTURE_MAG_FILTER: number
TEXTURE_MIN_FILTER: number
TEXTURE_WRAP_S: number
TEXTURE_WRAP_T: number
TEXTURE0: number
TEXTURE1: number
TEXTURE10: number
TEXTURE11: number
TEXTURE12: number
TEXTURE13: number
TEXTURE14: number
TEXTURE15: number
TEXTURE16: number
TEXTURE17: number
TEXTURE18: number
TEXTURE19: number
TEXTURE2: number
TEXTURE20: number
TEXTURE21: number
TEXTURE22: number
TEXTURE23: number
TEXTURE24: number
TEXTURE25: number
TEXTURE26: number
TEXTURE27: number
TEXTURE28: number
TEXTURE29: number
TEXTURE3: number
TEXTURE30: number
TEXTURE31: number
TEXTURE4: number
TEXTURE5: number
TEXTURE6: number
TEXTURE7: number
TEXTURE8: number
TEXTURE9: number
TRIANGLE_FAN: number
TRIANGLE_STRIP: number
TRIANGLES: number
UNPACK_ALIGNMENT: number
UNPACK_COLORSPACE_CONVERSION_WEBGL: number
UNPACK_FLIP_Y_WEBGL: number
UNPACK_PREMULTIPLY_ALPHA_WEBGL: number
UNSIGNED_BYTE: number
UNSIGNED_INT: number
UNSIGNED_SHORT: number
UNSIGNED_SHORT_4_4_4_4: number
UNSIGNED_SHORT_5_5_5_1: number
UNSIGNED_SHORT_5_6_5: number
VALIDATE_STATUS: number
VENDOR: number
VERSION: number
VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number
VERTEX_ATTRIB_ARRAY_ENABLED: number
VERTEX_ATTRIB_ARRAY_NORMALIZED: number
VERTEX_ATTRIB_ARRAY_POINTER: number
VERTEX_ATTRIB_ARRAY_SIZE: number
VERTEX_ATTRIB_ARRAY_STRIDE: number
VERTEX_ATTRIB_ARRAY_TYPE: number
VERTEX_SHADER: number
VIEWPORT: number
ZERO: number

Methods

activeTexture(texture: number)

Specifies which texture unit to make active.

Attaches either a fragment or vertex WebGLShader to a WebGLProgram.

bindBuffer(target: number, buffer: WebGLBuffer | null)

Binds a given WebGLBuffer to a target.

bindFramebuffer(target: number, framebuffer: WebGLFramebuffer | null)

Bind the given WebGLFramebuffer object to the given binding point (target), which must be FRAMEBUFFER. If framebuffer is null, the default framebuffer provided by the context is bound and attempts to modify or query state on target FRAMEBUFFER will generate an INVALID_OPERATION error. An attempt to bind an object marked for deletion will generate an INVALID_OPERATION error, and the current binding will remain untouched.

bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer | null)

Bind the given WebGLRenderbuffer object to the given binding point (target), which must be RENDERBUFFER. If renderbuffer is null the renderbuffer object currently bound to this target is unbound. An attempt to bind an object marked for deletion will generate an INVALID_OPERATION error, and the current binding will remain untouched.

bindTexture(target: number, texture: WebGLTexture | null)
blendColor(
r: number,
g: number,
b: number,
a: number,
)

Sets the source and destination blending factors.

blendEquation(mode: number)

Sets both the RGB blend equation and alpha blend equation to a single equation.

blendEquationSeparate(modeRGB: number, modeAlpha: number)

Sets the RGB blend equation and alpha blend equation separately.

blendFunc(sfactor: number, dfactor: number)

Defines which function is used for blending pixel arithmetic.

blendFuncSeparate(
srcRGB: number,
dstRGB: number,
srcAlpha: number,
dstAlpha: number,
)

Defines which function is used for blending pixel arithmetic for RGB and alpha components separately.

bufferData(
target: number,
data: ArrayBufferView | number,
usage: number,
)

Initializes and creates the buffer object's data store.

clear(mask: number)

Clears buffers to preset values.

clearColor(
r: number,
g: number,
b: number,
a: number,
)

Specifies the color values used when clearing color buffers.

clearDepth(depth: number)

Specifies the clear value for the depth buffer.

clearStencil(s: number)

Specifies the clear value for the stencil buffer.

colorMask(
r: boolean,
g: boolean,
b: boolean,
a: boolean,
)

Sets which color components to enable or to disable when drawing or rendering to a WebGLFramebuffer.

Compiles a GLSL shader into binary data so that it can be used by a WebGLProgram.

copyTexImage2D(
target: number,
level: number,
internalformat: number,
x: number,
y: number,
width: number,
height: number,
border: number,
)

Creates and initializes a WebGLBuffer storing data such as vertices or colors.

Creates and initializes a WebGLFramebuffer object.

Creates and initializes a WebGLProgram object.

Create a WebGLRenderbuffer object and initialize it with a renderbuffer object name as if by calling glGenRenderbuffers.

createShader(type: number): WebGLShader

Creates a WebGLShader that can then be configured further using WebGLRenderingContext.shaderSource() and WebGLRenderingContext.compileShader().

cullFace(mode: number)

Specifies whether or not front- and/or back-facing polygons can be culled.

deleteBuffer(buffer: WebGLBuffer | null)

Deletes a given WebGLBuffer. This method has no effect if the buffer has already been deleted.

deleteFramebuffer(framebuffer: WebGLFramebuffer | null)

Deletes a given WebGLFramebuffer object. This method has no effect if the frame buffer has already been deleted.

deleteProgram(program: WebGLProgram | null)

Mark for deletion the program object contained in the passed WebGLProgram, as if by calling glDeleteProgram. If the object has already been marked for deletion, the call has no effect. Note that underlying GL object will be automatically marked for deletion when the JS object is destroyed, however this method allows authors to mark an object for deletion early.

deleteShader(shader: WebGLShader | null)

Mark for deletion the shader object contained in the passed WebGLShader, as if by calling glDeleteShader. If the object has already been marked for deletion, the call has no effect. Note that underlying GL object will be automatically marked for deletion when the JS object is destroyed, however this method allows authors to mark an object for deletion early.

deleteTexture(texture: WebGLTexture | null)
depthFunc(func: number)

Specifies a function that compares incoming pixel depth to the current depth buffer value.

depthMask(flag: boolean)

Sets whether writing into the depth buffer is enabled or disabled.

depthRange(zNear: number, zFar: number)

Specifies the depth range mapping from normalized device coordinates to window or viewport coordinates.

disable(cap: number)

Disables specific WebGL capabilities for this context.

Disable the vertex attribute at index as an array. WebGL imposes additional rules beyond OpenGL ES 2.0 regarding enabled vertex attributes

drawArrays(
mode: number,
first: number,
count: number,
)

Renders primitives from array data.

drawElements(
mode: number,
count: number,
type: number,
offset: number,
)

Draw using the currently bound element array buffer. The given offset is in bytes, and must be a valid multiple of the size of the given type or an INVALID_OPERATION error will be generated; in addition the offset must be non-negative or an INVALID_VALUE error will be generated; see Buffer Offset and Stride Requirements. If count is greater than zero, then a non-null WebGLBuffer must be bound to the ELEMENT_ARRAY_BUFFER binding point or an INVALID_OPERATION error will be generated.

enable(cap: number)

Enables specific WebGL capabilities for this context.

Turns on the generic vertex attribute array at the specified index into the list of attribute arrays.

framebufferRenderbuffer(
target: number,
attachment: number,
renderbuffertarget: number,
renderbuffer: WebGLRenderbuffer | null,
)

Attaches a WebGLRenderbuffer object to a WebGLFramebuffer object.

framebufferTexture2D(
target: number,
attachment: number,
textarget: number,
texture: WebGLTexture | null,
level: number,
)

Attaches a texture to a WebGLFramebuffer.

frontFace(mode: number)

Specifies whether polygons are front- or back-facing by setting a winding orientation.

generateMipmap(target: number)
getActiveAttrib(program: WebGLProgram, index: number): { name: string; size: number; type: number; }

Returns a new WebGLActiveInfo object describing the size, type and name of the vertex attribute at the passed index of the passed program object. If the passed index is out of range, generates an INVALID_VALUE error and returns null. Returns null if any OpenGL errors are generated during the execution of this function.

getActiveUniform(program: WebGLProgram, index: number): { name: string; size: number; type: number; }

Returns a new WebGLActiveInfo object describing the size, type and name of the uniform at the passed index of the passed program object. If the passed index is out of range, generates an INVALID_VALUE error and returns null. Returns null if any OpenGL errors are generated during the execution of this function.

getAttribLocation(program: WebGLProgram, name: string): number

Returns the location of an attribute variable in a given WebGLProgram.

Returns a WebGLContextAttributes object that contains the actual context parameters. Might return null, if the context is lost.

getError(): number

Returns error information.

getExtension(name: string): null

Returns an object if, and only if, name is an ASCII case-insensitive match [HTML] for one of the names returned from getSupportedExtensions; otherwise, returns null. The object returned from getExtension contains any constants or functions provided by the extension. A returned object may have no constants or functions if the extension does not define any, but a unique object must still be returned. That object is used to indicate that the extension has been enabled.

getParameter(pname: number): string | number | Int32Array

Returns a value for the passed parameter name.

If program was generated by a different WebGLRenderingContext than this one, generates an INVALID_OPERATION error. Returns null if any OpenGL errors are generated during the execution of this function.

getProgramParameter(program: WebGLProgram, pname: number): number | boolean | undefined

Return the value for the passed pname given the passed program. The type returned is the natural type for the requested pname.

getShaderInfoLog(shader: WebGLShader): string

Returns the information log for a shader object.

getShaderParameter(shader: WebGLShader, pname: number): number | boolean

Returns information about the given shader.

getShaderPrecisionFormat(shaderType: number, precisionType: number): { rangeMin: number; rangeMax: number; precision: Int32Array; }

Return a new WebGLShaderPrecisionFormat describing the range and precision for the specified shader numeric format. The shadertype value can be FRAGMENT_SHADER or VERTEX_SHADER. The precisiontype value can be LOW_FLOAT, MEDIUM_FLOAT, HIGH_FLOAT, LOW_INT, MEDIUM_INT or HIGH_INT. Returns null if any OpenGL errors are generated during the execution of this function.

Returns a list of all the supported WebGL extensions.

getUniformLocation(program: WebGLProgram, name: string): WebGLUniformLocation | null

Return a new WebGLUniformLocation that represents the location of a specific uniform variable within a program object. The return value is null if name does not correspond to an active uniform variable in the passed program.

hint(target: number, mode: number)

Specifies hints for certain behaviors. The interpretation of these hints depend on the implementation.

isEnabled(cap: number): boolean

Tests whether a specific WebGL capability is enabled or not for this context.

lineWidth(width: number)

Sets the line width of rasterized lines.

Links a given WebGLProgram, completing the process of preparing the GPU code for the program's fragment and vertex shaders.

pixelStorei(pname: number, param: number)

Specifies the pixel storage modes.

polygonOffset(factor: number, units: number)

Specifies the scale factors and units to calculate depth values. The offset is added before the depth test is performed and before the value is written into the depth buffer.

readPixels(
x: number,
y: number,
width: number,
height: number,
format: number,
type: number,
pixels: ArrayBufferView,
)

Pixels in the current framebuffer are read back into an ArrayBufferView object. Fills pixels with the pixel data in the specified rectangle of the frame buffer. The data returned from readPixels must be up-to-date as of the most recently sent drawing command.

renderbufferStorage(
target: number,
internalformat: number,
width: number,
height: number,
)
sampleCoverage(value: number, invert: boolean)

Specifies multi-sample coverage parameters for anti-aliasing effects.

scissor(
x: number,
y: number,
width: number,
height: number,
)

Sets a scissor box, which limits the drawing to a specified rectangle.

shaderSource(shader: WebGLShader, source: string)

Sets the source code of a WebGLShader.

stencilFunc(
func: number,
ref: number,
mask: number,
)

Sets the front and back function and reference value for stencil testing.

stencilFuncSeparate(
face: number,
func: number,
ref: number,
mask: number,
)

Sets the front and/or back function and reference value for stencil testing.

stencilMask(mask: number)

Controls enabling and disabling of both the front and back writing of individual bits in the stencil planes.

stencilMaskSeparate(face: number, mask: number)

controls enabling and disabling of front and/or back writing of individual bits in the stencil planes. The WebGLRenderingContext.stencilMask() method can set both, the front and back stencil writemasks to one value at the same time.

stencilOp(
fail: number,
zfail: number,
zpass: number,
)

Sets both the front and back-facing stencil test actions.

stencilOpSeparate(
face: number,
fail: number,
zfail: number,
zpass: number,
)

Sets the front and/or back-facing stencil test actions.

texImage2D(
target: number,
level: number,
internalformat: number,
width: number,
height: number,
border: number,
format: number,
type: number,
pixels: ArrayBufferView | null,
)
texParameteri(
target: number,
pname: number,
param: number,
)
uniform1f(location: WebGLUniformLocation | null, x: number)
uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[])
uniform1i(location: WebGLUniformLocation | null, v0: number)
uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void
uniform2f(
location: WebGLUniformLocation | null,
x: number,
y: number,
)
uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[])
uniform2i(
x: number,
y: number,
)
uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void
uniform3f(
location: WebGLUniformLocation | null,
x: number,
y: number,
z: number,
)
uniform3fv(location: WebGLUniformLocation | null, v: Float32Array | number[])
uniform3i(
x: number,
y: number,
z: number,
)
uniform3iv(location: WebGLUniformLocation | null, v: Int32Array | number[]): void
uniform4f(
location: WebGLUniformLocation | null,
x: number,
y: number,
z: number,
w: number,
)
uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void
uniform4i(
x: number,
y: number,
z: number,
w: number,
)
uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void
uniformMatrix2fv(
transpose: boolean,
value: Float32Array | number[],
): void
uniformMatrix3fv(
location: WebGLUniformLocation | null,
transpose: boolean,
value: Float32Array | number[],
)
uniformMatrix4fv(
location: WebGLUniformLocation | null,
transpose: boolean,
value: Float32Array | number[],
)
useProgram(program: WebGLProgram | null)

Sets the specified WebGLProgram as part of the current rendering state.

vertexAttrib1f(index: number, x: number): void
vertexAttrib1fv(index: number, v: Float32Array | number[]): void
vertexAttrib2f(
index: number,
x: number,
y: number,
): void
vertexAttrib2fv(index: number, v: Float32Array | number[]): void
vertexAttrib3f(
index: number,
x: number,
y: number,
z: number,
): void
vertexAttrib3fv(index: number, v: Float32Array | number[]): void
vertexAttrib4f(
index: number,
x: number,
y: number,
z: number,
w: number,
): void
vertexAttrib4fv(index: number, v: Float32Array | number[]): void
vertexAttribPointer(
index: number,
size: number,
type: number,
normalized: boolean,
stride: number,
offset: number,
)

Specify constant values for generic vertex attributes.

viewport(
x: number,
y: number,
width: number,
height: number,
)

Sets the viewport, which specifies the affine transformation of x and y from normalized device coordinates to window coordinates.