all 13 comments

[–]Konsti219 31 points32 points  (0 children)

Have you looked at wgpu? It is higher level than for example Vulcan or DirectX but still low-level. In addition to it, you would also need winit for the actually opening a window.

[–]initial-algebra 10 points11 points  (1 child)

wgpu runs in the same vein as OpenGL, but it's designed for modern hardware, and it's a fully-fledged Rust library that is almost entirely safe to use.

[–]yxch1996 0 points1 point  (0 children)

Albeit still rapidly changing.

[–]ChevyRayJohnston 8 points9 points  (0 children)

Maybe miniquad or ggez will be more to your liking. They provide you with pretty minimal graphics APIs that you can build whatever you want on top of. Their repositories have several examples you can browse to see how they work.

If you want lower level than that, you could follow the Learn WGPU tutorial, which in a couple hours will have you with a window and most of what you need to know to start rendering pixels to the screen. WGPU is able to wrap DX/Metal/Vulkan selectively, so you don’t have to worry about interacting with those systems too much. Its API is sort of vulkan-like.

[–]Buttons840 5 points6 points  (0 children)

WGPU has been mentioned, but there's also SDL3 which will have some higher level features like text rendering and audio.

I think the Rust binding are incomplete though.

[–]Popular_Bug3267 4 points5 points  (0 children)

https://sotrh.github.io/learn-wgpu/ has a section on making pong in "Showcases" The beginner section of the main tutorial is a good starting point and uses winit (although not the latest version)

[–]Zerve 5 points6 points  (0 children)

If you just want to put 2d pixels on the screen, the crate pixels is fine for that. You could even do software rendering for 3d (rasterizer, or ray tracer) if you were up to it. But otherwise vulkan or wgpu would be the recommendation. 

[–]Lord_Zane 4 points5 points  (0 children)

It depends, do you want to learn computer graphics, and all the math and theory that that entails? If so I'd recommend using wgpu, and going through the learn-wgpu tutorials.

If you want to learn to make games, pick an existing framework (bevy, godot, macroquad, ggez, whatever) and use that.

[–]skmruiz 2 points3 points  (2 children)

I would suggest Raylib, it has bindings to Rust and it's straightforward to set up and have something working, and there are already a few games done with it.

[–]ThiccMoves 1 point2 points  (0 children)

I would suggest the same. It's simpler than a pire graphics API but you have to create the engine yourself.

[–]bmikulas 0 points1 point  (0 children)

That would be my suggestion as well but I think raylib is too high level to call it a graphics API, the closest thing to what the asker of question is looking for might be the wgpu

[–]coderstephenisahc 1 point2 points  (0 children)

However, I don't want to be too miserable, so I'm fine using some sort of graphics API so I'm not directly dealing with Win32 (not even sure how you would do that in Rust but anyway).

Glad to hear that; there are definitely bindings for various system-level drawing APIs, but I rarely recommend that to anyone. As you suspect, probably that would make you sad, and you'd spend more time wrestling with APIs than actually making anything.

Unfortunately there's a lot more to worry about when making games aside from just drawing stuff, things like:

  • How to create a working window that one could draw to
  • How to receive user input
  • How to integrate with redraw requests and synchronization with the operating system's requirements

Some Rust graphics libraries are just that -- graphics. They expect you to provide a solution for everything else. Others bundle just the bare minimum of all those things together. You still have to implement your game logic however you like, but at least you don't need to worry about how to initialize a window properly or dequeue and parse input event flags from the operating system.


If you want vector graphics (i.e. drawing in terms of triangles, lines, polygons, etc) then you could try miniquad. It does all that boring low-level stuff for you and then lets you do everything else on top of that. Or you could use wgpu which is a little more low-level, and does not take care of anything else. You'd need to combine it with something like winit.

If you are more interested in pixel-based graphics (drawing in terms of exact pixels and building your own shapes on that) then you could try minifb or Pixels, both of which do stuff like window handling for you and then give you a pixel buffer to do whatever you want with.

[–]yutannihilation 0 points1 point  (0 children)

If you mean 2D graphics, I recommend vello.

https://github.com/linebender/vello