hadronized/luminance-rs

Would a Glow Backend Be Useful as an Official Luminance Backend?

Closed this issue · 3 comments

I recenty created a glow backend for Luminance that I was curious if it might be useful as an official Luminance backend. The biggest advantage of it is the fact that the glow backend can target both web and desktop without having to have two separate luminance-gl and luminance-webgl crates. Seems like it could be a maintenance advantage.

Maybe this doesn't make sense for Luminance, but it was interesting so I figured I'd let you know about it in case you thought it might be useful:

https://github.com/katharostech/luminance-glow


On a side note, I forked the luminance-glow backend from the luminance-webgl backend and it is mostly a straight-forward port with some extra changes around organization.

I actually made the crate so I could target Safari on iOS which only supports WebGL 1. While I got WebGL 1 support working, there are nuances with it that make the experience not the "first class" luminance experience because you need different framebuffer formats on desktop and web and you also need to use GLSL ES 1.0 as a shading language instead of GLSL ES 3.0. 😝

Still, it worked rather well and I'm very happy with the portability it granted my renderer. 🙂

Hello,

I’m super happy to hear that! I dont plan to support luminance-glow directly in this repository but I’ll add a link to the repository you provided. However, I would be very interested to add a type to luminance-webglto getWebGL1` support there. :)

Good work!

I’m super happy to hear that! I dont plan to support luminance-glow directly in this repository but I’ll add a link to the repository you provided.

Cool! :)

However, I would be very interested to add a type to luminance-webgl to get WebGL1 support there. :)

🤔 I'm not exactly sure how you would go about that without switching to using glow instead of directly using web-sys. The way glow handles it is by having an enum that is matched on for every GL API call so that it can call the proper function on either the WebGL1 or WebGL2 context types from web-sys. For example:

    unsafe fn compile_shader(&self, shader: Self::Shader) {
        // ...
        match self.raw {
            RawRenderingContext::WebGl1(ref gl) => gl.compile_shader(raw_shader),
            RawRenderingContext::WebGl2(ref gl) => gl.compile_shader(raw_shader),
        }
    }

You could do that directly in luminance-webgl, but I think you would essentially just be duplicating the work that glow is already doing at that point.

luminance and glow are two completely different projects, I don’t plan to support WebGL via anything else than the WebGL API.