Coder Social home page Coder Social logo

Can't build for web about raycaster-rust HOT 3 CLOSED

elo-siema avatar elo-siema commented on June 5, 2024
Can't build for web

from raycaster-rust.

Comments (3)

elo-siema avatar elo-siema commented on June 5, 2024

Update: I got it to compile and run the main loop in the browser by using the mechanism for starting emscripten main loop from here , but all I see is black rectangle on the page :/
The functions:

self.canvas.copy(&texture, None, None).unwrap();
self.canvas.present();

are being called, but there's no output on the canvas.
I'd really appreciate if you had some info on the tried & true toolkit.

from raycaster-rust.

elo-siema avatar elo-siema commented on June 5, 2024

Update: This branch: https://github.com/elo-siema/hyperbolic-raycaster-rust/tree/web-build
Manages to render the first frame, and then panics:

thread panicked while processing panic. aborting. raycaster.js:2351:16
exception thrown: RuntimeError: unreachable executed,std::panicking::rust_panic_with_hook::h4771cee0d781dbd0@http://localhost:6931/raycaster.wasm:wasm-function[685]:0x217ca

I'm almost certain this has something to do with Emscripten mishandling references captured in the main loop lambda, losing them from iteration to iteration. Main loop function called like

loop{
...
}

works fine and tries to render frames (just doesn't show them due to blocking of thread).

Once during experiments I saw this piece of code (called from main_loop in emscripten)

let width =window.view.canvas.window().size().0;
let height = window.view.canvas.window().size().1;
println!("{}, {}", width, height);

output "0, 0" and panic on a next line trying to manipulate the canvas.

This looks to me like a severe regression bug in Emscripten.

from raycaster-rust.

elo-siema avatar elo-siema commented on June 5, 2024

Update: Managed to solve it on my fork. Definitely an issue with Emscripten main loop.
https://elo-siema.github.io/hyperbolic-raycaster-rust/

from raycaster-rust.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.