This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository Direct3D.wiki.
View the commit online.
commit b90ed8bd9e3907284f29cb6543c87e13a901de61
Author: Vincent Torri <vincent.to...@gmail.com>
AuthorDate: Fri Aug 18 21:52:01 2023 -0700
Update 'Direct3D 11 for 2D: Display a pink triangle'
---
Direct3D-11-for-2D%3A-Display-a-pink-triangle.md | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/Direct3D-11-for-2D%3A-Display-a-pink-triangle.md b/Direct3D-11-for-2D%3A-Display-a-pink-triangle.md
index 0d025d7..f5213af 100644
--- a/Direct3D-11-for-2D%3A-Display-a-pink-triangle.md
+++ b/Direct3D-11-for-2D%3A-Display-a-pink-triangle.md
@@ -66,7 +66,7 @@ We have to pass the vertices of our triangle (which are the geometric data) to t
### Vertex and Pixel shaders
-The following code is the HLSL code which contains both the function `main_vs()` for the vertex shader program, and the function `main_ps()` for the pixel shader program:
+The code below is the HLSL code which contains both the function `main_vs()` for the vertex shader program, and the function `main_ps()` for the pixel shader program. Save it under the name `shader_1.hlsl`.
```c
struct vs_input
@@ -106,3 +106,12 @@ float4 main_ps(ps_input input) : SV_TARGET
* The vertex shader program, named `main_vs()`, take as input a structure which has the coordinates of a vertex (of our triangle). It must be identical to the `Vertex structure above. It can also contains a color or a texture. The function returns a position with the 3 coordinates x, y and z, plus a fourth one (used for matrix transformations). The 4 coordinates are used when rotations or translations are needed. Then, they are transformed with a matrix of size 4x4. The new coordinates a [...]
* The pixel shader program, named `main_ps()`, takes as input the output of `` main_vs()`, that is, the final coordinate of the vertex. It will be called for each pixel in the polygon (that is a triangle in our case). It returns the color a the corresponding pixel, that is pink for each pixel in our case.
+
+### Rendering
+
+* We first call all the drawing operations. For our triangle, we call `DrawIndexed()`. This function, or the function `Draw()`, must be called for each primitive (point, line, triangles) that must be rendered.
+* When finished, swap front and back buffer with the `Present()` function as we already did.
+
+### The full code
+
+The file `shader_1.hlsl` must be saved in the same directory than `win.c` and `d3d_2.c` (as well as all the other following sections). Here is the full D3D code, followed with the diff between `d3d_1.c` and `d3d_2.c`.
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.