Rust 2d Graphics

I'm looking for a library I can use to display 2d graphics in a window (on Mac OS, it doesn't need to be supported on other platforms). I'll only be drawing lines, triangles, and circles. And I'd prefer a simpler library that's relatively fast, as I won't be using anything like custom textures or lighting. Does anyone know of something I can use?

1 Like

For something that simple, I'd probably use minifb.

Thanks, I just looked at the documentation, but do you have to manually update the buffer with the objects drawn, or is there a function/method for that?

You mean functions to draw shapes in the buffer? You'd have to do that manually. It shouldn't be too hard if you're just drawing lines, triangles, and circles. If you want something anti-aliased or geometry based, you'll want a rendering library. (Which may be harder to find, because there's a lot of little details to account for in such a library, and can be less complex to just make geometry and render it on a GPU.)

Here's a library I'm working on that does this: flo_draw, with plenty of examples here. The basic API is very straightforward as I wanted a library I could use to render things without a whole lot of setup effort: see the circle example, for instance. Rendering is presently via OpenGL and glutin: OS X and Windows work well but Linux has proved finicky.

v0.2 is available from but v0.3 in github is nearly ready for a release and probably better to use.

I am still a huge fan of pathfinder.
It has most of the SVG features implemented and is pretty fast.

Thanks for all of your suggestions! After looking into each one I've decided to go with flo_draw (v0.2 for now, v0.3 once it comes out) for the simplicity, but I might try pathfinder in the future for more advanced animations. minifb seems useful if I need to draw with individual pixels (like if I visualize the Mandelbrot set), but for other things it seems hard to work with.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.