Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update 00_Window_surface.md
  • Loading branch information
Overv authored Jan 29, 2021
commit 6c028cf29f83f700717cfee200fd23a59280c608
17 changes: 6 additions & 11 deletions en/03_Drawing_a_triangle/01_Presentation/00_Window_surface.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,20 @@ platform-specific code anyway. GLFW actually has `glfwCreateWindowSurface` that
handles the platform differences for us. Still, it's good to see what it does
behind the scenes before we start relying on it.

Because a window surface is a Vulkan object, it comes with a
`VkWin32SurfaceCreateInfoKHR` struct that needs to be filled in. It has two
important parameters: `hwnd` and `hinstance`. These are the handles to the
window and the process.You need to define VK_USE_PLATFORM_WIN32_KHR before
including vulkan header file. Because include vulkan header file we define it
before including glfw header. and to use glfwGetWin32Window function we need to
include it from glfw3native header file and define GLFW_EXPOSE_NATIVE_WIN32 before
it , to make the function available for use.

```
To access native platform functions, you need to update the includes at the top:

```c++
#define VK_USE_PLATFORM_WIN32_KHR
#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>
#define GLFW_EXPOSE_NATIVE_WIN32
#include <GLFW/glfw3native.h>
```

now we can create our surface.
Because a window surface is a Vulkan object, it comes with a
`VkWin32SurfaceCreateInfoKHR` struct that needs to be filled in. It has two
important parameters: `hwnd` and `hinstance`. These are the handles to the
window and the process.

```c++
VkWin32SurfaceCreateInfoKHR createInfo{};
Expand Down