FANDOM


DefinitionEdit

The clearColor() method specifies the red, green, blue, and alpha values used by clear() to clear the color buffers.

SyntaxEdit

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

ParametersEdit

  • red: floating-point number between 0.0 and 1.0, the default value is 0.0
  • green: floating-point number between 0.0 and 1.0, the default value is 0.0
  • blue: floating-point number between 0.0 and 1.0, the default value is 0.0
  • alpha: floating-point number between 0.0 and 1.0, the default value is 0.0

ExamplesEdit

// The color black, fully opaque, will be used when the color buffers are cleared
gl.clearColor(0.0, 0.0, 0.0, 1.0);
// The color yellow, 50% opaque, will be used when the color buffers are cleared
gl.clearColor(1.0, 1.0, 0.0, 0.5);

See alsoEdit