Theme Catppuccin
Make yourself at homeCatppuccin

A softer light for long learning sessions.

Appearance

Loading your preference…

Dark palette

Choose a dark palette to try it.

Light uses Latte. Your choices stay in this browser.

A shader is a contract

SKETCHBOOK / 03 The program desk · 2-week chapter

Page 1 of 3: Two stages, two kinds of failure

Compilation is not linking

Two stages, two kinds of failure

A shader object compiles one stage’s source. A program links compatible stages into an executable pipeline. Check each compile result and the program link result separately, and attach the stage or file name to a bounded diagnostic. A valid vertex shader can still fail to link with an incompatible fragment input.

The starter reads a bounded source file, passes an explicit source length, and installs ownership before fallible compilation. Failed compilation therefore releases its shader object while the context remains current. The same pattern applies to the candidate program during link failure.

Use #version 330 core for this desktop course. GLSL ES 3.00 from the browser course has related ideas but different version and precision rules. Keep the environment in the file itself so an editor, compiler log, and reviewer can agree on the language being compiled.

TRY IT IN YOUR STUDIO

Add a paused exposure control to the panel. Deliberately break one stage and one interface, preserving the different logs.

From the page to your own work

Your studio assignment.

Give the exhibit a reliable shader workflow.

A finish line you can see

Your pulse control and last-good-program reload with two explained diagnostics.

  1. Handle a stage compilation failure and a program-interface failure.
  2. Refresh required uniform locations after replacement.
  3. Preserve the prior program when a candidate fails.
Keep the evidence in your weekly notebook ↗
Explain it like an engineer

Try answering aloud before opening the review notes. Use your own implementation as evidence.

Why can shader hot reload corrupt an otherwise valid frame?
  • Deleting the prior owner too early loses the fallback.
  • Stale interface metadata can target the wrong linked program.
  • GL calls still require the context thread and correct current state.

These prompts support practice; they are not an automatic assessment of your work.

A small creative variation ↗

Add one optional debug uniform and document why its absence is permitted.

Optional. Save it for later if this chapter already feels full.

Coming back after a break? ↩

Restore the starter shader, compile it, and change one constant before retrying reload.

Books & principles behind this study +

Original Parallax explanations and assignments, with these works for further reading.

YOUR MARGIN NOTES

Leave yourself a good question.

What changed your mind? What would you try next?

Notes are private to this browser and saved as you write.

A CHECKPOINT, NOT A SCORE

Can you explain the idea and try the exercise yourself?

Completion records your own assessment. It does not compile or test your C++.
Companion source 3 files