WebGLRenderingContext.clearColor()
Baseline
Widely available
This feature is well established and works across many devices and browser versions. Itâs been available across browsers since иÑÐ»Ñ 2015 г..
ÐеÑод 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
GLclampfspecifying the red color value used when the color buffers are cleared. Default value: 0. green-
A
GLclampfspecifying the green color value used when the color buffers are cleared. Default value: 0. blue-
A
GLclampfspecifying the blue color value used when the color buffers are cleared. Default value: 0. alpha-
A
GLclampfspecifying the alpha (transparency) value used when the color buffers are cleared. Default value: 0.
Return value
None.
Examples
gl.clearColor(1, 0.5, 0.5, 3);
To get the current clear color, query the COLOR_CLEAR_VALUE constant which returns a Float32Array.
gl.getParameter(gl.COLOR_CLEAR_VALUE);
// Float32Array[1, 0.5, 0.5, 1]
СпеÑиÑикаÑии
| Specification |
|---|
| WebGL Specification > # 5.14.3 > |