from Hacker News

WebGL + Rust: Basic Water Tutorial

by chinedufn on 1/7/19, 2:38 PM with 19 comments

  • by spullara on 1/7/19, 4:43 PM

    It doesn't look like water to me. This looks a lot more like water: http://madebyevan.com/webgl-water/
  • by shepmaster on 1/7/19, 9:04 PM

    For more work from the same author, see their presentation "Percy: Isomorphic Web Apps with Rust + WebAssembly" at the most recent Rust Belt Rust:

    - https://www.youtube.com/watch?v=M6RLvGqQU10&list=PLgC1L0fKd7...

  • by ProjectBarks on 1/7/19, 7:02 PM

    I have always thought about getting into rust but since so many of projects are web focused its hard to integrate it into a project. This really makes me want to explore Rust!
  • by ridiculous_fish on 1/7/19, 9:57 PM

    Question about code like this:

        fn render_reflection_fbo(
            &mut self,
            gl: &WebGlRenderingContext,
            state: &State,
            assets: &Assets,
        ) {
            gl.bind_framebuffer(...);
            gl.viewport(...);
    
            gl.clear_color(...);
            gl.clear(...);
    
    
    Setting the viewport and clear color sure look to be mutating, but they are being called on a shared reference (&WebGlRenderingContext).

    Why is it designed this way? Is this design considered sound, or is it a hack?

  • by bencollier49 on 1/7/19, 4:13 PM

    I like the visual pun with the crow made of stone flying across the scene.
  • by CyberDildonics on 1/7/19, 3:13 PM

    I'm not sure why rust and webassembly are significant here. All the webgl commands still need to be javascript and the shaders still need to be glsl. Almost nothing in a demo like this needs to be done on the cpu.