Skip to content

Commit

Permalink
Done upgrading Multiple Attribtues chapter
Browse files Browse the repository at this point in the history
  • Loading branch information
eliemichel committed Jun 29, 2024
1 parent 7460bd2 commit 256b853
Show file tree
Hide file tree
Showing 4 changed files with 248 additions and 87 deletions.
2 changes: 1 addition & 1 deletion _extensions/sphinx_literate/js/sphinx_literate.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const litBlockInfoStyle = `
text-align: right;
font-size: 0.8em;
position: absolute;
bottom: -0.7em;
top: calc(100% - 0.7em);
right: 0.5em;
margin-top: 0;
color: var(--color-foreground-lit-info);
Expand Down
7 changes: 3 additions & 4 deletions basic-3d-rendering/input-geometry/a-first-vertex-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,15 @@ std::vector<float> vertexData = {
// x2, y2
+0.0, +0.5
};
// We will declare vertexCount as a member of the Application class
vertexCount = static_cast<uint32_t>(vertexData.size() / 2);
```
The GPU-side vertex buffer is created **like any other buffer**, as introduced in the previous chapter. The main difference is that we must specify `BufferUsage::Vertex` in its `usage` field.
````{tab} With webgpu.hpp
```{lit} C++, Create vertex buffer
vertexCount = static_cast<uint32_t>(vertexData.size() / 2);
// Create vertex buffer
BufferDescriptor bufferDesc;
bufferDesc.size = vertexData.size() * sizeof(float);
Expand All @@ -339,8 +340,6 @@ queue.writeBuffer(vertexBuffer, 0, vertexData.data(), bufferDesc.size);

````{tab} Vanilla webgpu.h
```{lit} C++, Create vertex buffer (for tangle root "Vanilla")
vertexCount = static_cast<uint32_t>(vertexData.size() / 2);

// Create vertex buffer
WGPUBufferDescriptor bufferDesc{};
bufferDesc.nextInChain = nullptr;
Expand Down
Loading

0 comments on commit 256b853

Please sign in to comment.