Hello WebGL III
✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on Apr 23, 2013
This example demonstrates WebGL’s ability to generate a gradient directly on the GPU, where the fragment shader colors each pixel based on its x and y coordinates relative to the canvas size. Using a minimal vertex shader and a full-screen triangle fan, it renders a smooth color transition without any external data. The code compiles and links shaders manually via the WebGL API, sets uniform and attribute locations, and calls `drawArrays` to produce the final image.
AI-generated descriptionPart three of my introduction to WebGL, wherein the fragment shader computes the color based on the fragment coordinates.
Next: Part IV
gpl-3.0 Licensed