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.Createcreates the native windowshaderdefines GPU stagesMaterial<ShaderType>()creates a typed materialcanvas(window)starts the frame loopcmd.Clearandcmd.DrawIndexedissue per-frame commands
Next Steps
- Window and Frame Loop - Event and frame lifecycle
- Shaders and Materials - Typed shader fields