Skip to main content

Window and Frame Loop

Every graphics application starts with a window and a frame loop.


Create a Window

window is Window.Create(1280, 720, "My App");

Parameters:

  • width as int
  • height as int
  • title as string

Frame Loop with Canvas

canvas(window) {
OnFrame {
cmd.Clear(Color(0.1, 0.1, 0.12, 1.0));
}
}

OnFrame is where rendering work should run.


Rendering Scope Rules

  • Renderer2D.Render(scene) is valid only inside OnFrame
  • Renderer3D.Render(scene) is valid only inside OnFrame
  • cmd.* drawing commands are intended for frame scope

Next Steps