ibd1279 / vks

vks is a Vulkan bridge for Go.
BSD 3-Clause "New" or "Revised" License
6 stars 2 forks source link

Suggestion: Add glfw example #1

Open jensfredgaard opened 3 years ago

jensfredgaard commented 3 years ago

Hi Jason!

I think it would be really helpful if you would throw in an example of "how to use with glfw - draw triangle".

If you need help writing up some examples i can help you out.

At a first look your library seems very promising and i am really looking forward to giving it a Go! ;)

ibd1279 commented 3 years ago

In a more general sense, I crated this tutorial using vulkan-go. It covers the most general parts of using Go with Vulkan based on Vulkan tutorial.

It is probably a good idea to update it to use my own library. Most of the implementation would be the same. The creation of and access fields of the structs would be different, but it would provide a better test. Once I convert handles into receivers, so that the API looks more like GLFW's go API rather than the straight C API, I'll take a stab at rewriting the tutorial again.

If you have other examples (like maybe using SDL instead of GLFW, or other non-graphics use-cases for GPU programming) that would also be awesome.

jensfredgaard commented 3 years ago

Changing your own tutorial to use this library definitely makes sense!

I have a truck load of graphics libraries(glTF2.0, image library with support for AMDs Compressonator, etc..) i can make publicly available, when i convert them to support Vulkan instead of OpenGL, but no other non-graphics libraries comes to mind.

For OpenGL i made a CPU state library, that makes OpenGL a lot more efficient by handling uniforms to avoid re-binding already set value, VBO trimming, automated mesh generated based on existing primitives available in the shader. It would be fun the create this type of middleware for Vulkan as well.

I have worked with OpengGL for years and i am finally ready to transition to Vulkan, super excited!

ibd1279 commented 2 years ago

It is really high level (and mostly code rather than explaining what is happening), but a first attempt was checked in @ https://github.com/ibd1279/vks/tree/main/tutorial .

jensfredgaard commented 2 years ago

Nice summary!

go get -u github.com/ibd1279/vks returns:
vk_wrapper.go:6: ./vk_wrapper.h:7:10: fatal error: vulkan/vulkan.h: No such file or directory

Which makes sense since the Vulkan header is missing.

Is the install then: Download the package manually and add desired vulkan.h to the directory?

ibd1279 commented 2 years ago

I need to add this to the README: You need to download and install the Vulkan SDK. The mac installer (at least the most recent one), seems to handle everything. Not sure about the other platforms yet.

I should probably also expand the beginning of my tutorial to include more of the details from the Vulkan-Tutorial on environment setup.

jensfredgaard commented 2 years ago

I am currently using Windows 10.

In my case the VulkanSDK is installed in: "C:\VulkanSDK[version]\" and the header is in "C:\VulkanSDK[version]\Include\vulkan\".

In regards to the vulkan/vulkan.h. On your machine, is the vulkan directory a part of your environment variables, as in "export PATH=.... or how does it locate the vulkan.h file?