Task 1 of 4
Set graphical: true and a kernel stops returning numbers — instead
every thread paints exactly one pixel by calling
this.color(r, g, b, a), channels 0–1. The output shape becomes the canvas:
output: [128, 128] is a 128×128 picture, 16,384 threads, one per pixel.
A solid color is one line — and the starter already paints one. The interesting part is
that each thread knows where it is: this.thread.x counts columns from
the left, this.thread.y counts rows from the bottom (GL
convention). Divide either by the canvas size and you get a smooth 0–1 ramp, ready to feed
straight into a color channel.
x, green rising with y, blue fixed at 0.5.graphical: true and output: [128, 128]this.thread.x / 128this.thread.y / 1280.5, alpha stays 1this.thread.x runs 0…127 here, so
this.thread.x / 128 runs 0…0.992 — a ready-made red ramp.
Same move with this.thread.y for green.
The whole kernel body:
this.color(this.thread.x / 128, this.thread.y / 128, 0.5, 1);This page is an interactive exercise — the editor, the GPU runner and your saved progress need JavaScript. The text above is the full brief.