The Glium Library – Safe OpenGL in Rust
medium.com
medium.com
Here's hoping Vulkan will fix these issues in the future and Apple also adapting this platform.
With all major engines on Metal, Apple has nothing to lose by not supporting Vulkan, other than a few indie devs that stay away from engines.
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.
The weirdest thing about OpenGL is that you sometimes have to run one function before another function, for no good reason, but it gives you a giant performance boost.
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
If there are issues you could report them on https://github.com/tomaka/glium/issues
https://en.wikipedia.org/wiki/SRGB
However, one cannot do computations on an image in sRGB colorspace since the colorspace is not linear - the values will turn out wrong. I.e. imaging algorithms expect source data to be in linear colorspace, and if fed sRGB data the result will turn out more or less wrong.
Thus, when doing any weighting calculations etc. on a set of samples the samples must be in linear (e.g. RGB) colorspace.
Your OpenGL implementation may or may not handle this automatically for you if you specify the image to be in one of the sRGB texture formats. https://www.opengl.org/registry/specs/EXT/texture_sRGB.txt
So, in the general sense, if doing any handcoded imaging routines, and reading e.g. PNG image, one needs to convert it to linear colorspace before processing, and back to sRGB before writing to disk/displaying.
'The importance of being linear' is the best introduction to the topic I know: http://http.developer.nvidia.com/GPUGems3/gpugems3_ch24.html
Seems like Rust is making good progress (emphasis mine). I really should take the time to learn this 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!
The API has macros to automatically generate type boilerplate. Very clever
Also a link related to game developement in rust : https://www.reddit.com/r/rust_gamedev