Sokol or Raylib?

I would like to know what are the most important differences between using the Sokol versus Raylib bindings, e.g. when is one preferred over the other.

Sokol is more direct, Raylib is higher-level.

Raylib is higher-level in the sense that it provides a lot more for you. It can be as simple as “create a window, load some images, and while the window hasn’t been closed check some input and draw some stuff”. Drawing something on the screen can be as simple as telling it to load a texture and calling a proc to draw a shape/texture, playing audio is as simple as telling it to load a sound file and play it with some options. It has some 3D graphics functionality, but for anything non-trivial I think it’ll quickly become inadequate. It gets a lot of the heavy lifting out of the way and lets you start doing simple things without having to learn a lot.

Sokol is more direct in that it provides a wrapper over the basic functions (create a window, receive input, set up an audio interface, set up a graphics context), and then leaves the rest to you with some fairly thin abstractions. On the audio side, its audio interface only handles taking a stream of processed audio data and sending it to the appropriate audio interface. That means it requires you to load your own audio files, and process/mix the audio yourself. On the graphics side, it’s an abstraction somewhat close to using OpenGL or WebGPU; you still need to write shaders and set up GPU buffers to get anything on the screen, but in exchange you get a lot of control over how things work internally. There’ll be a much larger learning curve if you’re not familiar with those things at all.

4 Likes

Nice overview, thanks.

So then what this means is that for plain-vanilla game development with nothing too fancy , Raylib is sufficient, for beginners.

However, if you want to have low-level control and more advanced graphics effects then Sokol is the better choice, more for experienced developers.

1 Like

A bit late in coming back to this, but that’s the gist of it. It’s worth pointing out that Sokol isn’t even remotely as far as far as you can go in terms of low-level control, though; if you want, you can also jump directly to underlying graphics APIs (e.g. OpenGL, DirectX, Metal, Vulkan). That’s the way to actually get the most control, but most come with some downside or other. Sokol abstracts across several of them to give you an API that works everywhere. SDL3 also has a GPU API, and bindings to it just got added to vendor in dev-2025-02; it’s newer and more focused on modern APIs.

OpenGL is probably the simplest to start with if graphics APIs are new territory to you; it’s sort of at end-of-life and isn’t being updated to support cutting-edge features, but it’s reasonably well-supported on different platforms and plenty capable for most things short of AAA development and there are a wealth of resources out there discussing it. A lot of what you learn for OpenGL will apply to other APIs too (as long as you learn at least OpenGL 3, anyway).

1 Like

Thanks Barinzaya, it is much clearer now. I’m just starting to delve into the wonderful of game development and the endless available libraries and APIs, and it hard to navigate through the jungle. So far Raylib and Odin seem to be the right way to go, but checking just in case doesn’t hurt.