Im trying to lear Vulkan api from scratch (I assume my knowledge of OpenGL 1.1 - 2.0 are useless).
Well, asuming you did not use it mindlessly, the graphics theory behind is timeless. In fact one of the more enjoyable courses in school was when they asked us to actually implement OpenGL 1 (subset of it anyway).
Strictly API-wise it is complete rework (maybe the primitive topology is the only thing that survived). And well, I think in OpenGL 2.0 programmable shaders was already heavily used in profesional spheres(through extensions).
Speaking for myself, I had easier time learning some basic Vulkan. The cons is you have to “do many things yourself” in it. The pro is it is modern, object-oriented, stateless, conceptually clean thing. Another con is Vulkan has learning staircase – you need to know 80 % of Vulkan to make your first app (the hidden pro is you then know 80 % of Vulkan).
To achieve that I have read the Intel tutorial on the subjet and come to rewrite the example 2 in C.
For the love of, why?? Well at least not to Cobol.
but it seem that the first two image are actually black.
In case you don’t know, you need to use the Validation Layers. (They should shout that from the rooftops).
Since shaders are new for me I can’t understand why they are usefull.
They are programmable, while OpenGL 1 is fixed (\single-purpose).
For the next questions I assume that I am in a 2D space.
The vertex shader take care of the projection but since I dislike glOrtho and prefer normalized space it is useless right ?
Yup, that makes things easier. If you are already in 2D, you don’t need projection transformation.
You still might want transformation matrix for your 2D stuff for things like translation, rotation, scaling and so.
The geometry shader is here to exploit the power of the GPU to calculate shapes (static equations) ?
It is there to make new primitives (e.g. triangles) from data. I wouldn’t mess with it for your first program (it is optional).
The fragment shader give colors to pixels (the only usefull for my point of view) ?
Indeed. There’s also separate compute pipeline with compute shater, which is sort of like a fragment shader without the (mandatory) vertex shader.
Then again if you have triangles that need to be rasterized, you need graphics pipeline with a (useful) vertex shader.
And have you got any good C tutorials or books about Vulkan.
Do I?? There are now many tutorials, including large company sponsored ones like from LunarG, Intel, ARM, Google. “Good” is in the eye of the beholder. I scanned some of them; they certainly ain’t bad.
There’s official link page for this purpose: https://github.com/KhronosGroup/Khronosdotorg/blob/master/api/vulkan/resources.md
I am not sure about them being C. Some of them will probably be very C-like C++ (it can still be pretty time-consuming to write proper wrappers for a C API, and well, bit anti-didactic).
I also shamelessly offer my anti-tutorial Hello Triangle example, if that is more of your learning style.
Some books are out too including the traditional semi-official Red Book. (They probably use C++ too, because why the hell not.)