You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/1-introduction/1-1-getting-started/1-1-0-overview.md
+18-11Lines changed: 18 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,32 @@
1
1
# Overview
2
2
3
-
As many may know or not know, there's a few choices in terms of what to use for graphics, such as OpenGL, Vulkan, Metal and what is commonly known as "DirectX".
4
-
However in word of mouth DirectX usually refers to Direct3D, which is one of the many API's that DirectX has, as it is less known that DirectX is more than just graphics, it is:
3
+
As you may or may not know, there's a few choices in terms of what you can use for rendering, such
4
+
as OpenGL, Vulkan, Metal, and what is commonly known as "DirectX". However, in word of mouth
5
+
DirectX usually refers to Direct3D, which is one of the many API's that DirectX has. In fact
6
+
DirectX provides tooling and libraries for more aspects of game development, including:
5
7
6
8
-**Audio**
7
-
8
9
-**Fonts**
9
-
10
10
-**Input**
11
-
12
11
-**Graphics**
13
12
14
-
And _other things_ more or less targeted at stuff one needs for game development.
13
+
The goal of LearnD3D11 is, as one might guess, the targeted explanation and showcase of Direct3D11
14
+
within C++, or as one generally refers to it: "DirectX 11". This guide does _NOT_ cover DirectX 12,
15
+
the newer version of the API, as it is very low level and will usually require a good understanding
16
+
of the GPU and how it works. We will cover concepts and some techniques used in graphics programming,
17
+
and we do not expect you to have any prerequisites in this field. It is, however, not a guide
18
+
covering C++ or programming in general; we expect at least the ability and understanding to write
19
+
object-oriented programs in C++.
15
20
16
-
The goal of LearnD3D11 is as one might guess is the targeted explanation and showcase of Direct3D11 or as one generally refers to it: "DirectX 11".
21
+
During each step we'll provide a project for you to follow along as we explain everything for you
22
+
to start rendering geometry using your GPU.
17
23
18
-
During each step we'll provide a project for you to follow along as we explain each individual thing needed to get some graphics on your own screen.
24
+
Also note that DirectX is made by Microsoft and is generally only available on Windows. However,
25
+
`DXVK` was developed to run D3D9 through D3D11 on Linux or Wine on top of Vulkan and would be the
26
+
only way of developing and using D3D11 on those platforms.
19
27
20
-
This initial section will cover creating the actual window, initializing Direct3D11 and getting our very first visuals (which is commonly known as the Hello Triangle)
28
+
This initial section will cover creating the actual window, initializing Direct3D11 and getting our
29
+
very first visuals (which is commonly known as the Hello Triangle)
21
30
22
31
## Project structure
23
32
@@ -45,5 +54,3 @@ x-x-x-project.vcxproj
45
54
-`obj/` contains all intermediate junk the compiler produced, to keep the folder structure clean
46
55
-`bin/` will contain the compiled program of the chapter along with all necessary `Assets`
47
56
-`Assets/` will contain all the used assets, such as models, shaders and textures and other things. It will be empty for the first few chapters, and we will copy it and its contents to the bin/Debug or bin/Release directory, depending on which configuration you chose
or hit Escape and mapped Escape to close the window. [glfwPollEvents](https://www.glfw.org/docs/3.3/group__window.html#ga37bd57223967b4211d60ca1a0bf3c832)
162
162
will make sure that `GLFW` knows about all required events coming from the operating system.
@@ -200,7 +200,7 @@ The further we go into this tutorial series the more stuff we will add to the pr
200
200
But we don't want to cram everything into `Main.cpp`, your main entry point of the program.
201
201
A good practise is to split up things into smaller units, to not lose overview.
202
202
203
-
Right now we dont have much to show for, just a window, made by a few lines of code,
203
+
Right now we don't have much to show for, just a window, made by a few lines of code,
204
204
but we are going to abstract that code into a new class called `Application` which will also be
205
205
our main container so to speak, in which all the magic will happen.
206
206
@@ -363,9 +363,9 @@ int main(int argc, char* argv[])
363
363
}
364
364
```
365
365
366
-
Let's start with `Main.cpp`. That's all its doing, creating the hellowindow application and running it.
366
+
Let's start with `Main.cpp`. That's all its doing, creating the "hellowindow" application and running it.
367
367
In the future this can be accompanied by loading a configuration, initializing a logger,
368
-
initiating a connection to a possible server server, or other stuff.
368
+
initiating a connection to a possible server, or other stuff.
369
369
370
370
```cpp
371
371
public:
@@ -377,7 +377,7 @@ public:
377
377
This is a section of the `Application` class, showing only its publicly available methods. `Run` being
378
378
the most important one to the outside world, like `Main`, it's the entry point into this Application.
379
379
380
-
We still dont want to cram everything into one main or one method, therefore `Run` is split up
380
+
We still don't want to cram everything into one main or one method, therefore `Run` is split up
381
381
again into the following blocks.
382
382
383
383
```cpp
@@ -402,22 +402,22 @@ void Application::Run()
402
402
}
403
403
```
404
404
405
-
You can clearly see what it is doing. `Initialize`, as the name suggests, will initialize everything
406
-
which is required for the app to run, which currently is the window in our case. In future chapters it
407
-
will also including initializing `D3D11` and its resources or imgui for some UI.
405
+
This function is pretty simple. `Initialize`, as the name suggests, will initialize everything
406
+
which is required for the app to run, which currently is the window in our case. In future
407
+
chapters it will also include initializing `D3D11`, its resources, and ImGUI for the UI.
408
408
409
-
`Load`s purpose is to load all the assets required to run the application, in further chapters it will
409
+
`Load`'s purpose is to load all the assets required to run the application, in further chapters it will
410
410
encompass textures, shaders, models and other things.
411
411
412
-
The next block is the aforementioned mainloop or gameloop, which still does what it was doing before,
413
-
checking with the OS if events need to be processed and now we also call a `Update` and `Render` method.
412
+
The next block is the aforementioned mainloop or game loop, which still does what it was doing before,
413
+
checking with the OS if events need to be processed, and now we also call a `Update` and `Render` method.
414
414
415
415
`Update` may contain queries about pressed key or mouse buttons, updating variables or other things
416
416
which are - for instance - reflected on display inside the `Render` method.
417
417
418
418
You probably have noticed that all the protected method in `Application` are virtual, that's because
419
419
we are deriving from `Application` in form of `HelloWindowApplication` and only focus on those four
420
-
methods if required. We now dont have to deal with the mainloop anymore for the time being.
420
+
methods if required. We now don't have to deal with the mainloop anymore for the time being.
421
421
422
422
```cpp
423
423
virtualvoidCleanup();
@@ -438,5 +438,3 @@ and more.
438
438
[Raw Winapi Hello Window Project on GitHub](https://github.com/GraphicsProgramming/learnd3d11/tree/main/src/Cpp/1-getting-started/1-1-1-HelloWin32Window)
439
439
440
440
[Project on GitHub](https://github.com/GraphicsProgramming/learnd3d11/tree/main/src/Cpp/1-getting-started/1-1-1-HelloWindow)
What the parts of the `IID_PPV_ARGS(ppType)` macro are:
212
212
213
213
[the `ppType` in `IID_PPV_ARGS(ppType)`]
214
-
- a pointer to a pointer of a object.
214
+
- a pointer to a pointer of an object.
215
215
216
216
[the `__uuidof(**(ppType))` part of `IID_PPV_ARGS(ppType)`]
217
217
- at compile time retrieves a `UUID` from `ppType` type which represents a `GUID`, which is returned as a `REFIID` — which means that the type returned is a reference to an identifier to a specific type of COM object.
@@ -245,7 +245,7 @@ if (FAILED(D3D11CreateDevice(
245
245
}
246
246
```
247
247
248
-
This block is the the entry point into D3D11, where we ask for a device and its device context to be created. The input parameters are:
248
+
This block is the entry point into D3D11, where we ask for a device and its device context to be created. The input parameters are:
249
249
250
250
We want a LEVEL_11_0, hardware accelerated device, which has support for a specific color format.
251
251
Feature levels are a concept that has been introduced with D3D11, it is a way to specify which set of features we would like to use. Each GPU may support different feature levels (for example a very old GPU might only support LEVEL_9_1, while a more modern one may support every feature level up to, and including LEVEL_11_0), this is a way to avoid rewriting our application in D3D9 just because our GPU doesn't support D3D11.
@@ -290,7 +290,7 @@ The majority of values should make some sense without explanation, like width an
290
290
291
291
`BufferCount` is 2, because we want double buffering. Double buffering is an age-old technique to avoid presenting an image that is being used by the GPU, instead we work on the "back buffer", while the GPU is happy presenting the "front buffer", then, as soon as we are done with the back buffer, we swap front and back, and begin working on the former front buffer present that one and render to the other one again in the meantime. That process is supposed to reduce flicker or tearing.
292
292
293
-
`SwapEffect` specifies if the contents of the back buffer should be preserved or discarded after a swap, here we don't care about preserving the back buffer so we just discard everything.
293
+
`SwapEffect` specifies if the contents of the back buffer should be preserved or discarded after a swap, here we don't care about preserving the back buffer, so we just discard everything.
294
294
295
295
`AlphaMode` specifies how DXGI should handle transparency, we don't care about that (yet), so we'll just say it's unspecified and rely on default behaviour
When we render things, the GPU simply writes color values to a texture, which you can picture as a buffer which holds color information Swapchain is a container to manage those buffers we want to present on screen. To do that we have to create a special kind of texture called a "Render Target View" or an RTV. First off we have to grab a texture from the swapchain's main buffer (index 0), from that texture, we now have create an RTV from that, which specifies the subresource of the texture that we will be drawing to. We wont keep the actual texture around, we just need the render target view, which we will refer to as render target.
335
+
When we render things, the GPU simply writes color values to a texture, which you can picture as a buffer which holds color information Swapchain is a container to manage those buffers we want to present on screen. To do that we have to create a special kind of texture called a "Render Target View" or an RTV. First off we have to grab a texture from the swapchain's main buffer (index 0), from that texture, we now have to create an RTV from that, which specifies the subresource of the texture that we will be drawing to. We won't keep the actual texture around, we just need the render target view, which we will refer to as render target.
Finally we need to modify `Appplication.hpp` and `Application.cpp`. Since we want to handle resizing as well.
429
+
Finally, we need to modify `Appplication.hpp` and `Application.cpp`. Since we want to handle resizing as well.
430
430
431
431
### Application.hpp
432
432
@@ -446,7 +446,7 @@ virtual void OnResize(
446
446
[[nodiscard]] int32_t GetWindowHeight() const;
447
447
```
448
448
449
-
`HandleResize` will be the callback from `GLFW` which handles resize events and `OnResize` will be execute when GLFW runs HandleResize, so that we can handle our custom things we want to execute when resizing the window, like changing the size of the swapchain in our example.
449
+
`HandleResize` will be the callback from `GLFW` which handles resize events and `OnResize` will be executed when GLFW runs HandleResize, so that we can handle our custom things we want to execute when resizing the window, like changing the size of the swapchain in our example.
450
450
451
451
`GetWindow()` is used to derive the actual native window handle from, which is needed when we create the swapchain. `GetWindowWidth()` and `GetWindowHeight()` do what they say :) Also required for swapchain creation.
0 commit comments