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.

Give surfaces a language

SKETCHBOOK / 05 The texture table · 2-week chapter

Page 1 of 3: Begin with a generated label

Texture data you can inspect

Begin with a generated label

Generate a tiny checker or striped exhibit label in owned CPU memory. Validate dimensions, channel count, row bytes, and total byte count before upload. The texture owns GPU storage after the upload; its C++ wrapper owns deletion. The caller’s upload span only needs to remain valid for the synchronous data-copy contract of this ordinary client-memory call.

Use a sized internal format to describe GPU storage and a matching source format/type to describe the CPU bytes. A texture object is separate from a texture unit: activate a unit, bind the object for that unit, and set the sampler uniform to the unit index rather than the GLuint texture name.

Pixel unpack alignment describes row layout. A tightly packed RGB row can violate the default alignment even when the buffer length looks plausible. Either prepare correctly aligned rows or establish and restore a suitable unpack alignment as part of the upload boundary. These examples use client memory with no GL_PIXEL_UNPACK_BUFFER bound and the default zero row-length/skip settings; a bound pixel-unpack buffer changes the data argument into an offset into that buffer.

TRY IT IN YOUR STUDIO

Make your own two-color label. Test a row layout that is not naturally four-byte aligned with a CPU byte-count calculation before submitting it to GL.

From the page to your own work

Your studio assignment.

Give the room original exhibit labels with a known color path.

A finish line you can see

A generated label and floor texture, an upload-layout test, and a color-pipeline diagram.

  1. Validate upload byte counts and row alignment.
  2. Explain texture object versus texture unit and sampler index.
  3. State where RGB decoding and final encoding occur.
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 should an albedo map and a normal map usually have different color-format treatment?
  • Albedo may be encoded display color that needs decoding.
  • Normal-map components represent numeric directions.
  • Applying an unintended transfer function changes the data meaning.

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

A small creative variation ↗

Add one alternate generated label with the same dimensions and upload contract.

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

Coming back after a break? ↩

Use a 2 by 2 RGBA texture and nearest filtering until the binding and UV path are clear.

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