Learn WebGPU
Basics: Your first triangle

A colorful triangle

Understand per-vertex color and interpolation.

Learning steps

Vertices can carry more than just position.

Attribute examples:

  • position
  • color
  • uv (texture coordinates)
  • normal

Passing data between shaders: Use @location to forward data from the vertex shader to the fragment shader.

Task

Add a color attribute to the vertex shader.

Progress 0 / 2 completed

WebGPUを初期化中...

コンソール
コンソール出力がここに表示されます

Learn WebGPU — interactive tutorials for learning WebGPU

GitHub