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.

From bytes to a draw

SKETCHBOOK / 02 The geometry desk · 2-week chapter

Page 1 of 3: Upload bytes, then describe them

Storage is not a vertex format

Upload bytes, then describe them

A buffer stores bytes. A vertex attribute declaration explains how a draw interprets some of those bytes: component count, scalar type, normalization, stride, and offset. A VAO retains the vertex-input configuration used for later draws. It does not replace the buffer owner or magically infer the C++ struct layout.

The starter interleaves position and color in a standard-layout Vertex and uses sizeof(Vertex) for stride and offsetof for field offsets. The pointer-looking argument is a byte-offset token into the bound buffer for this API call, not a host pointer that OpenGL should dereference. Keep that API-specific convention localized.

In this baseline, glVertexAttribPointer captures the currently bound array buffer into the VAO’s attribute association. Simply rebinding GL_ARRAY_BUFFER later does not redirect that stored attribute. Enable the intended locations explicitly and keep the GLSL input locations aligned with the C++ description.

TRY IT IN YOUR STUDIO

Trace one vertex’s position and color bytes through their stride and offsets. Change only a color first, then deliberately diagnose one wrong offset.

From the page to your own work

Your studio assignment.

Turn one triangle into your own indexed exhibit panel.

A finish line you can see

An original four-vertex panel, index-range test, and byte-layout sketch.

  1. Use two triangles with six indices and a deliberate winding.
  2. Explain stride, offsets, and the element-buffer association.
  3. Test one invalid index before any GL upload.
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.

What does a VAO remember about vertex input?
  • Attribute format, enable state, and captured buffer associations.
  • The element-buffer binding belongs to the VAO.
  • Changing the generic array-buffer binding alone does not rewrite an existing attribute.

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

A small creative variation ↗

Give each corner an original palette value and compare interpolation across the diagonal.

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

Coming back after a break? ↩

Return to one triangle and inspect its two active attribute locations.

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 2 files