lovr.graphics.setBackgroundColor
EditChanges the global background color. The textures in a render pass will be cleared to this color at the beginning of the pass if no other clear option is specified. Additionally, the headset and window will be cleared to this color before rendering.
Arguments
| Name | Type | Default | Description |
| r | number | The red component of the background color. | |
| g | number | The green component of the background color. | |
| b | number | The blue component of the background color. | |
| a | number | 1.0 | The alpha component of the background color. |
Returns
Nothing
Arguments
| Name | Type | Default | Description |
| hex | number |
A hexcode (like 0xffffff) to use for the background color (does not support alpha).
| |
| a | number | 1.0 | The alpha component of the background color. |
Returns
Nothing
Arguments
| Name | Type | Description |
| table | table | A table containing 3 or 4 color components. |
Returns
Nothing
Notes
Setting the background color in lovr.draw will apply on the following frame, since the default pass is cleared before lovr.draw is called.
Internally, this color is applied to the default pass objects when retrieving one of them using lovr.headset.getPass or lovr.graphics.getWindowPass. Both are called automatically by the default lovr.run implementation.
Using the background color to clear the display is expected to be more efficient than manually clearing after a render pass begins, especially on mobile GPUs.