top | item 10095501

The Glium Library – Safe OpenGL in Rust

163 points| bpbp-mango | 10 years ago |medium.com | reply

26 comments

order
[+] inDigiNeous|10 years ago|reply
Excellent writing on the pitfalls of OpenGL and how to circumvent those. Applies to any OpenGL programming, not just Rust also.

Here's hoping Vulkan will fix these issues in the future and Apple also adapting this platform.

[+] mtgx|10 years ago|reply
It seems unlikely Apple would adopt Vulkan at this point. Maybe if Vulkan came out a year ago. The only thing that might convince them is if big developers such as Blizzard and whoever else decides to write PC/Android games in Vulkan. EA's Dice was already pushing for Mantle, which is now part of Vulkan, so maybe most of EA's games could be written in Vulkan in the future. That might get Apple to adopt it, even if 80% of iOS games will use Metal instead of OpenGL ES by that point.
[+] archimedespi|10 years ago|reply
Another cool thing he mentions is that it does something sort of like React's diffing.

When you tell Glium, "make me these three polygons, add a light source, apply a transform matrix", it optimizes the number of OpenGL calls it needs to do, and the kinds thereof, and puts them in the right order to run most efficiently.

Like React, it optimizes state changes required for speed to get a view from one state to another.

[+] mastax|10 years ago|reply
The fact that Glium needs to do this demonstrates how flawed the state-wrangling in OpenGL has become. Vulkan can't come fast enough.
[+] fsloth|10 years ago|reply
Sounds great! Dare I try it on windows now? (The last n times I did ... things did not work out).

Kudos for taking also the texture colorspace issue into account - I've found people new to real time programming tend to find this initiaĺly one of the most bysantine minutiae one absolutely needs to get right

[+] inDigiNeous|10 years ago|reply
First time I've heard about it in any writings. Put onto my list how to implement it. Any good articles on the RGB vs sRGB colorspace issue in OpenGL ?
[+] jdub|10 years ago|reply
This is a fantastic example of how to make a foreign API safe and neat in a Rust-y kind of way. The author has done a great job with hlua too (see previous blog post).
[+] zamalek|10 years ago|reply
> The “untextured objects” example of AZDO: drawing 64x64x64 individual moving objects. The glium version runs at approximately the same speed as the original pure OpenGL example.

Seems like Rust is making good progress (emphasis mine). I really should take the time to learn this language.

[+] tomaka|10 years ago|reply
The fact that it runs at approximately the same speed isn't really important. You would get the same result with any language.

The AZDO examples show what the most optimized OpenGL techniques are, and I just wanted to show that you can do the same thing with glium as with raw OpenGL.

That being said, you should still try Rust!

[+] awestroke|10 years ago|reply
This seems fantastic compared to my experiments in C + glut. Great work!

The API has macros to automatically generate type boilerplate. Very clever

[+] thorn|10 years ago|reply
So, Rust is ready for writing high performant games?
[+] shmerl|10 years ago|reply
Why not? I hope it will really shine in combination with Vulkan though, not with OpenGL.
[+] bananaoomarang|10 years ago|reply
Why not :)? Seems like a great fit to me, we'll see in the long run though.