Source: https://mokxi.com/teachers/plans/graphics-from-scratch
Updated: 2026-11-19

Lesson plan

# Computer graphics from scratch lesson plan

Write every pixel yourself in C++ on an ESP32-C3: framebuffers, lines, circles, matrices, perspective and wireframes, ending with a spinning space station.

4 chapters, 7 lessons, about 6 hours, on the ESP32-C3-DevKitM-1. Every lesson runs in the browser, with nothing to install.

Start a class from this course

The unit

## Objectives and materials

### By the end, students can

- A picture in RAM, and the whole-number line every renderer still uses.
- Circles, fills and the matrices that turn, move and scale anything.
- Divide by depth, then spin a wireframe and profile every frame.
- A space station built in code and flown from the game pad.

### Materials for the whole unit

- ESP32-C3-DevKitM-1
- Full-size breadboard
- Game console buttons
- TFT display, 240x320

Every part is already on the simulator’s bench, so there is nothing to buy or hand out. The counts are the most any one lesson uses, if you build it on real breadboards too.

Chapter 1. About 1 h 50 min

## Pixels and lines

A picture in RAM, and the whole-number line every renderer still uses.

Lesson | Time | What students do

Framebuffers Hold a picture in RAM, one byte a pixel, draw a starfield and a planet into it, count and checksum it, and send it to the screen in one go. | 55 min

- A picture in RAM
- Draw by writing bytes
- Send it down the wire
- Move the planet
- Fill the sky

Bresenham lines Draw a straight line on a grid with whole numbers only, trace the error term pixel by pixel, race it against floats, and fan a starburst. | 55 min

- Rule a line
- Walk the error
- Integers against floats
- Steep lines
- A starburst

### Materials

- ESP32-C3-DevKitM-1
- Full-size breadboard
- TFT display, 240x320

### Check for understanding

Each student finishes "Bresenham lines" on their own, without opening the hints. The simulator checks 5 of its 5 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "A starburst".

Chapter 2. About 1 h 40 min

## Shapes and transforms

Circles, fills and the matrices that turn, move and scale anything.

Lesson | Time | What students do

Circles and fills Draw a circle with the midpoint rule and eight-way symmetry, fill a disc from spans, and flood a crater floor with a ring-buffer queue. | 55 min

- Eight for the price of one
- Fill with spans
- Flood the crater
- A bigger planet
- Seed the peak

Transforms Turn, move and scale a satellite outline with 2D matrices, prove that the order of transforms matters, and spin it on the screen. | 45 min

- Turn a point
- Order matters
- Spin the satellite
- Scale it up

### Materials

- ESP32-C3-DevKitM-1
- Full-size breadboard
- TFT display, 240x320

### Check for understanding

Each student finishes "Transforms" on their own, without opening the hints. The simulator checks 4 of its 4 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Scale it up".

Chapter 3. About 1 h 40 min

## Into 3D

Divide by depth, then spin a wireframe and profile every frame.

Lesson | Time | What students do

3D projection Divide by depth: project a cube's eight corners onto the screen by hand, then move the camera and change its lens and watch perspective change. | 45 min

- Divide by depth
- Near is big
- Walk closer
- Change the lens

Wireframes Turn, project, clear, draw, flush: spin a wireframe cube at 26 frames a second, profile every frame, and swap the model for your own. | 55 min

- Points and edges
- The render loop
- Where the time goes
- Spin faster
- Your own model

### Materials

- ESP32-C3-DevKitM-1
- Full-size breadboard
- TFT display, 240x320

### Check for understanding

Each student finishes "Wireframes" on their own, without opening the hints. The simulator checks 5 of its 5 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Your own model".

Chapter 4. About 55 min

## Boss

A space station built in code and flown from the game pad.

Lesson | Time | What students do

Boss: a spinning space station A wireframe space station built in code (hub, ring, spokes and solar panels), spun and tilted from the game pad, with depth shading on the far side. | 55 min

- Build it in code
- Take the controls
- Tilt it toward you
- Depth shading
- A smoother ring

### Materials

- ESP32-C3-DevKitM-1
- Full-size breadboard
- Game console buttons
- TFT display, 240x320

### Check for understanding

Each student finishes "Boss: a spinning space station" on their own, without opening the hints. The simulator checks 5 of its 5 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "A smoother ring".

Your class

## Teach this unit as a class

Start a class from this course and its 7 lessons are assigned in one go, in order. Students join with a six-character code or printed login cards, and each one’s work comes back to you.

The class tools are free for 30 days for one class of up to 20 students, with no card. The lessons themselves are free either way.

Start a class from this course See the demo class

More units

## Other lesson plans

Electronics basics 20 lessons, about 10 h. Embedded on the Arduino Uno 16 lessons, about 12 h. Embedded on the ESP32-C3 13 lessons, about 11 h. Embedded on the Raspberry Pi Pico 7 lessons, about 6 h. Build your own fight stick 5 lessons, about 4 h. Embedded on the STM32F411 6 lessons, about 6 h. C++ on a board 13 lessons, about 10 h. Digital logic and memory 4 lessons, about 4 h. Interactive devices on the Uno 9 lessons, about 8 h. From gates to a computer 23 lessons, about 16 h. Build a claw machine 8 lessons, about 6 h. Every unit All the courses as ready-made units, on the teachers page.
