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

#include "Leadwerks.h"

using namespace Leadwerks;

int main(int argc, const char *argv[])
{
Leadwerks::Window* window = Leadwerks::Window::Create();
Context* context = Context::Create(window);
World* world = World::Create();
Camera* camera = Camera::Create();
camera->Move(0, 0, -3);
Light* light = DirectionalLight::Create();
light->SetRotation(35, 35, 0);

//Create a model
Model* model = Model::Box();
model->SetColor(0.0, 0.0, 1.0);

while (true)
{
if (window->Closed() || window->KeyDown(Key::Escape)) break;

Vec4 color = camera->GetClearColor();
color.r = Math::Mod(color.r + Leadwerks::Leadwerks::Time::GetSpeed()*0.01, 1);
color.g = Math::Mod(color.g + Leadwerks::Leadwerks::Time::GetSpeed()*0.012, 1);
color.b = Math::Mod(color.b + Leadwerks::Leadwerks::Time::GetSpeed()*0.015, 1);
camera->SetClearColor(color);

model->Turn(0, Leadwerks::Leadwerks::Time::GetSpeed(), 0);

Leadwerks::Leadwerks::Time::Update();
world->Update();
world->Render();
context->Sync();
}
}