Learning graphics programming is about more than just learning APIs. It's about learning how graphics works. Vertex transformations, lighting models, shadow techniques, texture mapping, deferred rendering, and so forth. These have absolutely nothing to do with the API you use to implement them.
So the question is this: do you want to learn how to use an API? Or do you want to learn graphics?
In order to do stuff with hardware-accelerated graphics, you have to learn how to use an API to access that hardware. But once you have the ability to interface with the system, your graphics learning stops focusing on what the API does for you and instead focuses on graphics concepts. Lighting, shadows, bump-mapping, etc.
If your goal is to learn graphics concepts, the time you're spending with the API is time you're not spending learning graphics concepts. How to compile shaders has nothing to do with graphics. Nor does how to send them uniforms, how to upload vertex data into buffers, etc. These are tools, and important tools for doing graphics work.
But they aren't actually graphics concepts. They are a means to an end.
It takes a lot of work and learning with Vulkan before you can reach the point where you're ready to start learning graphics concepts. Passing data to shaders requires explicit memory management and explicit synchronization of access. And so forth.
By contrast, getting to that point with OpenGL requires less work. And yes, I'm talking about modern, shader-based core-profile OpenGL.
Just compare what it takes to do something as simple as clearing the screen. In Vulkan, this requires at least some understanding of a large number of concepts: command buffers, device queues, memory objects, images, and the various WSI constructs.
In OpenGL... it's three functions: glClearColor
, glClear
, and the platform-specific swap buffers call. If you're using more modern OpenGL, you can get it down to two: glClearBufferuiv
and swap buffers. You don't need to know what a framebuffer is or where its image comes from. You clear it and swap buffers.
Because OpenGL hides a lot from you, it takes a lot less effort to get to the point where you're actually learning graphics as opposed to learning the interface to graphics hardware.
Furthermore, OpenGL is a (relatively) safe API. It will issue errors when you do something wrong, usually. Vulkan is not. While there are debugging layers that you can use to help, the core Vulkan API will tell you almost nothing unless there is a hardware fault. If you do something wrong, you can get garbage rendering or crash the GPU.
Coupled with Vulkan's complexity, it becomes very easy to accidentally do the wrong thing. Forgetting to set a texture to the right layout may work under one implementation, but not another. Forgetting a sychronization point may work sometimes, but then suddenly fail for seemingly no reason. And so forth.
All that being said, there are two caveats to be pointed out here.
First, the above is true but only for the time being. Now that a few years have passed since command-buffer APIs have come into being, hardware vendors are starting to develop important graphical features that fundamentally cannot work under OpenGL.
Ray tracing is the prime example here. It requires such a fundamentally different rendering structure that OpenGL just has no way to handle it. This isn't like mesh shaders, where you replace the vertex processing pipeline with a different one. Here, you absolutely need to be able to access any texture/buffer at any time for any reason. And while you kind of can do that in OpenGL with bindless textures and a few other extensions, it ultimately becomes too complicated to make work with the structure of OpenGL.
But Vulkan's command-buffer based API handles it just fine.
As time goes on, more and more graphical features like this will exist. Features which are inherently incompatible with OpenGL-like APIs. So for the time being, OpenGL and Vulkan have transferable graphical concepts, this will become increasingly less true as time goes on. New features will be added to Vulkan and not OpenGL, not because OpenGL is old, but because it just can't work well with those features.
Second, there is more to learning graphics than learning graphical techniques. There's one area in particular where Vulkan wins.
Graphical performance.
Being a 3D graphics programmer usually requires some idea of how to optimize your code. And it is here where OpenGL's hiding of information and doing things behind your back becomes a problem.
The OpenGL memory model is synchronous. The implementation is allowed to issue commands asynchronously so long as the user cannot tell the difference. So if you render to some image, then try to read from it, the implementation must issue an explicit synchronization event between these two tasks.
But in order to achieve performance in OpenGL, you have to know that implementations do this, so that you can avoid it. You have to realize where the implementation is secretly issuing synchronization events, and then rewrite your code to avoid them as much as possible. But the API itself doesn't make this obvious; you have to have gained this knowledge from somewhere.
With Vulkan... you are the one who has to issue those synchronization events. Therefore, you must be aware of the fact that the hardware does not execute commands synchronously. You must know when you need to issue those events, and therefore you must be aware that they will probably slow your program down. So you do everything you can to avoid them.
An explicit API like Vulkan forces you to make these kinds of performance decisions. And therefore, if you learn the Vulkan API, you already have a good idea about what things are going to be slow and what things are going to be fast.
If you have to do some framebuffer work that forces you to create a new renderpass... odds are good that this will be slower than if you could fit it into a separate subpass of a renderpass. That doesn't mean you can't do that, but the API tells you up front that it could cause a performance problem.
In OpenGL, the API basically invites you to change your framebuffer attachments willy-nilly. There's no guidance on which changes will be fast or slow.
So in that case, learning Vulkan can help you better learn about how to make graphics faster. And it will certainly help you reduce CPU overhead.
It'll still take much longer before you can get to the point where you can learn graphical rendering techniques.