OpenGL and Rust - what are the options?


I am getting my feet wet by learning the ropes of the Rust language.

I learned how to program in C and C++ by creating small graphics demos because I learn best by having fun :smile:

I have been using Ogre3D for a long while, and while I could write a Rust wrapper for it - I probably will eventually - I want an easier route into Rust.

And I am looking at the options:

Piston - seems to be a loose collection of Rust crates geared mainly towards 2D graphics ?

Glium - and Glutin - looks nice - but then there’s gl-rs which seems to be a better option if I want to stay close to ‘real’ OpenGL (modern).

My instincts tells me to go for gl-rs, but there are several crates that I am interested in that depends on Glium.
Glium seems to be not using gl-rs but wrapping directly?

I guess my question is: where is the action ?
I am mainly interested in 3D and being in control and I would favor GLFW over SDL.

What are you guys using for 3D graphics?
And why are you using it?
And what graphics wrapping crates would it be wise to bet on?


I learned Rust through wrapping libraries (though rarely as large as Ogre) and really loved it. It’s interesting to see how well some of the security features of Rust map practices of C libs and evolve your code based on your new learnings.

Might still not be your way of learning, but I really loved it and didn’t find it too hard.


There is also gfx, but I have not tried it.

My understanding is that Glium and gl-rs use the same binding generator, which is a part of gl-rs.

I’ve tried to learn some OpenGL using Glium and it was pretty cool. Much more convenient and safe than raw OpenGL (and much easier buildable than raw C++ :slight_smile: ). Also if the aim is to learn Rust then Glium might be a better option than raw OpenGL because it cleverly uses Rust features to achieve safety, which is fundamentally what Rust is about.


With Ogre I would have to solve a lot of problems: Like Qt, it has a lot of nested enums and magic tricks and overloaded methods, so it would require that I write a proper C API for it first - I am only half-way there :slight_smile:

Definitely my way of learning - thanks for the encouragement :blush:


Good point - I had a feeling that Glium would be the rustiest option.
And why it would be a good idea to launch my Rust journey using it :slight_smile:


I’ve decided to go for gfx-rs with glutin :wink:

Or maybe I should say: “rust for” instead of “go for:stuck_out_tongue: