lovr.graphics.clear

Clears the screen, resetting the color, depth, and stencil information to default values. This function is called automatically by lovr.run at the beginning of each frame to clear out the data from the previous frame.

Clears the color, depth, and stencil to their default values. Color will be cleared to the current background color, depth will be cleared to 1.0, and stencil will be cleared to 0.

lovr.graphics.clear(color, depth, stencil)

Arguments

NameTypeDefaultDescription
colorbooleantrueWhether or not to clear color information on the screen.
depthbooleantrueWhether or not to clear the depth information on the screen.
stencilbooleantrueWhether or not to clear the stencil information on the screen.

Returns

Nothing


lovr.graphics.clear(r, g, b, a, z, s)

Arguments

NameTypeDefaultDescription
rnumberThe value to clear the red channel to, from 0.0 to 1.0.
gnumberThe value to clear the green channel to, from 0.0 to 1.0.
bnumberThe value to clear the blue channel to, from 0.0 to 1.0.
anumberThe value to clear the alpha channel to, from 0.0 to 1.0.
znumber1.0The value to clear the depth buffer to.
snumber0The integer value to clear the stencil buffer to.

Returns

Nothing


lovr.graphics.clear(hex)

Arguments

NameTypeDescription
hexnumberA hexcode to clear the color to, in the form 0xffffff (alpha unsupported).

Returns

Nothing

Notes

The first two variants of this function can be mixed and matched, meaning you can use booleans for some of the values and numeric values for others.

If you are using lovr.graphics.setStencilTest, it will not affect how the screen gets cleared. Instead, you can use lovr.graphics.fill to draw a fullscreen quad, which will get masked by the active stencil.

See also