SetClearColor

This function sets the clear color of a camera. The clear color is the background color a camera draws when rendered.

Syntax

Parameters

Example

--Create a window
window = Window:Create()
context = Context:Create(window)
world = World:Create()
camera = Camera:Create()
camera:Move(0,0,-3)
local light = DirectionalLight:Create()
light:SetRotation(35,35,0)

model = Model:Box()
model:SetColor(0.0,0.0,1.0)

while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end

local color = camera:GetClearColor()
color.r = Math:Mod(color.r + Time:GetSpeed()*0.01,1)
color.g = Math:Mod(color.g + Time:GetSpeed()*0.012,1)
color.b = Math:Mod(color.b + Time:GetSpeed()*0.015,1)
camera:SetClearColor(color)

model:Turn(0,Time:GetSpeed(),0);

Time:Update()
world:Update()
world:Render()
context:Sync()
end