# Learn WebGPU for native graphics in C++ (with GLFW)

**URL:** <https://discourse.glfw.org/t/learn-webgpu-for-native-graphics-in-c-with-glfw/2368>\
**Category:** share\
**Created:** [April 28, 2023, 12:20pm UTC](https://discourse.glfw.org/t/learn-webgpu-for-native-graphics-in-c-with-glfw/2368 "2023-04-28T12:20:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [April 28, 2023, 12:20pm UTC](https://discourse.glfw.org/t/learn-webgpu-for-native-graphics-in-c-with-glfw/2368/1 "2023-04-28T12:20:11Z")

</div>

Work in progress article on learning WebGPU with cross platform native graphics in C++ using GLFW (work in progress, note that I am not the author).

> **[Learn WebGPU](https://eliemichel.github.io/LearnWebGPU/index.html)**
>
> For native graphics in C++. This documentation walks you through the use of the WebGPU graphics API to create native 3D applications in C++ from scratch, for Windows, Linux and macOS. Contents: Int...

---

<div class="post-metadata">

**Author:** ![bmitc](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/bmitc/32/664_2.png) [@bmitc](https://discourse.glfw.org/u/bmitc)\
**Post date:** [August 10, 2023, 8:18am UTC](https://discourse.glfw.org/t/learn-webgpu-for-native-graphics-in-c-with-glfw/2368/2 "2023-08-10T08:18:12Z")

</div>

Do you or anyone else know if there are any plans to incorporate the WebGPU extension or some other WebGPU support into GLFW at some point?

I am investigating WebGPU as a replacement for Skia and would ideally like to keep using GLFW.

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [August 10, 2023, 8:42am UTC](https://discourse.glfw.org/t/learn-webgpu-for-native-graphics-in-c-with-glfw/2368/3 "2023-08-10T08:42:53Z")

</div>

The linked article uses GLFW for window creation and events, along with a very small set of functions which use the [GLFW native interface to create a WebGPU surface](https://github.com/eliemichel/LearnWebGPU-Code/blob/step020/glfw3webgpu/glfw3webgpu.c).

So you can keep using GLFW along with the above code.

---

<div class="post-metadata">

**Author:** ![bmitc](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/bmitc/32/664_2.png) [@bmitc](https://discourse.glfw.org/u/bmitc)\
**Post date:** [August 20, 2023, 1:35am UTC](https://discourse.glfw.org/t/learn-webgpu-for-native-graphics-in-c-with-glfw/2368/4 "2023-08-20T01:35:35Z")

</div>

Thanks for the response.

Context: I am using F# with my own custom bindings to GLFW’s released binaries.

I saw that they are using GLFW already, but are you saying that their little C++ extension library is just using functions already exposed in GLFW to implement the WebGPU interfacing? So I could simply port their C++ code to use my GLFW bindings and whatever WebGPU bindings I end up using?

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [August 20, 2023, 9:00am UTC](https://discourse.glfw.org/t/learn-webgpu-for-native-graphics-in-c-with-glfw/2368/5 "2023-08-20T09:00:19Z")

</div>

Yes, they’ve not altered GLFW but just use the GLFW native interface. So you can add a binding for their function `glfwGetWGPUSurface` (there is only the one function they have created for WebGPU as far as I can tell).
