WebGLRenderingContext.clearColor()

Метод WebGLRenderingContext.clearColor() из WebGL API определяет значения, используемые для задания цвета во время очистки буферов цвета.

This specifies what color values to use when calling the clear() method. Эти значения находятся в пределах от 0 до 1.

Syntax

void gl.clearColor(red, green, blue, alpha);

Parameters

red

A GLclampf (en-US) specifying the red color value used when the color buffers are cleared. Default value: 0.

green

A GLclampf (en-US) specifying the green color value used when the color buffers are cleared. Default value: 0.

blue

A GLclampf (en-US) specifying the blue color value used when the color buffers are cleared. Default value: 0.

alpha

A GLclampf (en-US) specifying the alpha (transparency) value used when the color buffers are cleared. Default value: 0.

Return value

None.

Examples

js
gl.clearColor(1, 0.5, 0.5, 3);

To get the current clear color, query the COLOR_CLEAR_VALUE constant which returns a Float32Array.

js
gl.getParameter(gl.COLOR_CLEAR_VALUE);
// Float32Array[1, 0.5, 0.5, 1]

Specifications

Specification
WebGL Specification
# 5.14.3

Совместимость с браузерами

BCD tables only load in the browser

See also