Hello_Triangle icon indicating copy to clipboard operation
Hello_Triangle copied to clipboard

Feature request: c branch

Open gertcuykens opened this issue 4 years ago • 4 comments

Would you mind creating a c branch? When looking at the cpp file I am not sure if its trivial to translate the c++ code into c ?

gertcuykens avatar Jun 15 '20 02:06 gertcuykens

Well, the map to C is trivial, but it is tedious. Can you elaborate on what are the motivations to have such a branch?

krOoze avatar Jun 15 '20 15:06 krOoze

Basically in golang I can call c but not c++ and think it would also be nice to compare both languages c and c++ for does who want to use vulkan.

gertcuykens avatar Jun 15 '20 16:06 gertcuykens

This is not really a library. What do you intend to use from go?

For language comparison purposes this is also bit unsuitable. C++ app should perhaps use Vulkan-Hpp to show its strengths. This is not really a language comparison. What I want is to show Vulkan commands while not really imposing any structure on the program. So it is already mostly procedural and C-istic, except where C++ makes it so much nicer (e.g. std::vector and range-for instead of malloc and pointer+count hell).

krOoze avatar Jun 15 '20 18:06 krOoze

Before I can understand something like https://github.com/vulkan-go/vulkan I would like to make sure I understand vulkan c before I attempt to wrap my head around to see if it's humanly possible to use vulkan for simple gui purposes. Also I think maintaining something like https://github.com/vulkan-go/vulkan is almost not feasible because of the tedious work involved. So you end up just picking the vulkan c parts you need and only wrap does parts in cgo if you want to keep up with latest sdk vulkan releases.

To summarize I agree that hello triangle probably looks way better in c++ but the main reason for the request I think is that without a basic c example many people including me will fail and make tons of mistakes abandoning vulkan adoption in their programing language because they already failed in writing hello triangle in c. I believe c is the way to go for better integration with other languages like golang or rust and was also the original goal of vulkan to be as program language independent as possible by writing the sdk itself in c. That it's going to be a pain to write hello triangle in c, understandably so, but that only increases the demand for it I believe. As far as I can tell, all examples I try to find are c++. We have not a single hello triangle indicating the base c platform is working so we then can continue in a attempt to draw a triangle with other languages.

gertcuykens avatar Jun 16 '20 03:06 gertcuykens