Skip to main content

Graphics Quick Start

This is the smallest practical graphics program: open a window and draw a mesh.


Minimal Example

BasicLit is shader {
tint as Color;

Vertex method(position as Vector3) {
return MVP * position;
}

Fragment method() {
return tint;
}
}

Init method() {
window is Window.Create(800, 600, "Quick Start");
mesh is Mesh.Load("examples/assets/triangle.obj");
material is Material<BasicLit>();
material.tint is Color(1.0, 0.2, 0.2, 1.0);

canvas(window) {
OnFrame {
cmd.Clear(Color(0.08, 0.08, 0.10, 1.0));
cmd.DrawIndexed(mesh, material);
}
}
}

What This Shows

  • Window.Create creates the native window
  • shader defines GPU stages
  • Material<ShaderType>() creates a typed material
  • canvas(window) starts the frame loop
  • cmd.Clear and cmd.DrawIndexed issue per-frame commands

Next Steps