Comment

Comment by ridiculous_fish

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?

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton