Skip to content

Commit e2d4c25

Browse files
committed
Upgrade First Attribute chapter
1 parent b78e368 commit e2d4c25

File tree

5 files changed

+310
-132
lines changed

5 files changed

+310
-132
lines changed

basic-3d-rendering/hello-triangle.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,17 @@ We now detail the configuration of the **different stages**. We start with a ver
109109

110110
Both the **vertex fetch** and **vertex shader** stages are configured through the **vertex state** structure, accessible at `pipelineDesc.vertex`.
111111

112+
```{lit} C++, Describe vertex pipeline state (also for tangle root "Vanilla")
113+
// Configure 'pipelineDesc.vertex'
114+
{{Describe vertex buffers}}
115+
{{Describe vertex shader}}
116+
```
117+
112118
The render pipeline first **fetches vertex attributes** from some buffers that lives in GPU memory. These *attributes* include usually at least a **vertex position**, and might include additional per-vertex information like **color**, **normal**, **texture coordinate**, etc.
113119

114120
**In this first example**, we hard-code the position of the 3 vertices of the triangles in shaders so we do not even need a position buffer.
115121

116-
```{lit} C++, Describe vertex pipeline state (also for tangle root "Vanilla")
122+
```{lit} C++, Describe vertex buffers (also for tangle root "Vanilla")
117123
// We do not use any vertex buffer for this first simplistic example
118124
pipelineDesc.vertex.bufferCount = 0;
119125
pipelineDesc.vertex.buffers = nullptr;
@@ -125,7 +131,7 @@ Then each vertex is processed by a custom **vertex shader**. A shader is the com
125131
2. An **entry point**, which is the name of the function in the shader module that must be called for each vertex. This enables a given shader module to include entry points for multiple render pipeline configurations at the same time. In particular, we use the same module for the vertex and fragment shaders.
126132
3. An array of value assignments for the **constants** of the shader. We do not use any for now.
127133

128-
```{lit} C++, Describe vertex pipeline state (append, also for tangle root "Vanilla")
134+
```{lit} C++, Describe vertex shader (also for tangle root "Vanilla")
129135
// NB: We define the 'shaderModule' in the second part of this chapter.
130136
// Here we tell that the programmable vertex shader stage is described
131137
// by the function called 'vs_main' in that module.

0 commit comments

Comments
 (0)