Conversation
…r consistency between native/web
…he glutin window, the only event which does this
…UniformLocation doesn't so gl::Uniform can't
This reverts commit 472208c.
|
I think I'm missing a step. Lots of different ways to do this, in flux. The example at https://github.com/grovesNL/glow/tree/main/examples/hello says to run with: cargo build --target wasm32-unknown-unknown
mkdir -p generated
wasm-bindgen ../../target/wasm32-unknown-unknown/debug/hello.wasm --out-dir generated --target web
cp index.html generatedThis fails on the first step, with a different error (even though despite the And I used to build with Guides: |
let mut file = BufWriter::new(fs::File::create("conf.cfg").unwrap());conditionally-compiling out, next failure is in threading (but called from where?) |
|
Restoring std_or_web until there is something better, current failure: Panic error message: – "attempted to leave type What is this core/src/mem/mod.rs:658? If this is the right version of the library, https://github.com/rust-lang/rust/blob/master/library/core/src/mem/mod.rs#L658: pub unsafe fn uninitialized<T>() -> T {
// SAFETY: the caller must guarantee that an unitialized value is valid for `T`.
unsafe {
intrinsics::assert_uninit_valid::<T>();
MaybeUninit::uninit().assume_init()
}What is webcore::serialization::SerializedValue? Looks like it is in our old friend stdweb: https://docs.rs/stdweb/0.4.20/src/stdweb/webcore/value.rs.html Building with After removing localstoragefs since it requires stdweb, and replacing std_or_web with a stubbed-out File, we are back to the original Thread error: skin thread: impl TextureManager {
fn new(
res: Arc<RwLock<resources::Manager>>,
) -> (
TextureManager,
mpsc::Sender<String>,
mpsc::Receiver<(String, Option<image::DynamicImage>)>,
) {
let (tx, rx) = mpsc::channel();
let (stx, srx) = mpsc::channel();
let skin_thread = thread::spawn(|| Self::process_skins(srx, tx));After disabling the skin thread, the errors get more interesting: |
…S 3.0 / WebGL 2.0
…(but still require WebGL 2 ~ OpenGL ES 3.0)
|
Updating to support The current error is related to accum and revealage outputs in src/render/shaders/chunk_frag.glsl: Useful articles: https://webgl2fundamentals.org/webgl/lessons/webgl1-to-webgl2.html and https://webgl2fundamentals.org/webgl/lessons/webgl2-whats-new.html, in particular, WebGL2 is more on par with what this project needs (it uses vertex arrays, etc., now always available in WebGL2 unlike WebGL1) |
|
https://www.khronos.org/opengl/wiki/Fragment_Shader#Outputs Now gets as far as hitting the multisample sample in src/render/shaders/trans_frag.glsl:
|
A small step for #446 🕸️ Web support, use web-sys to interface to the web. Previously, we would try to use glutin on the web, which is not supported; now glutin is only used on native: fixes #171 could not find Context in platform_impl. winit is still used on both, but the GL context is created with web-sys and glow (on the web), and created with glutin and used with glow (on native). stdweb is no longer used, being replaced by web-sys. Substantial refactoring to allow reusing the code between web/native: * settings: use VirtualKeyCode from winit, not reexported from glutin * std_or_web: remove broken localstoragefs/stdweb, add File placeholder * render: disable skin_thread on wasm since we don't have threads * gl: use glow types in gl wrapper (integers in native, but Web*Key in web) * gl: web-sys WebGlUniformLocation does not implement Copy trait, so glow::UniformLocation doesn't so gl::Uniform can't * gl: refactor context initialization, pass glow::Context to gl::init for consistency between native/web * gl: update to glow with panicking tex_image_2d_multisample web-sys wrapper * glsl: use shader version in GLSL for WebGL 2 and OpenGL 3.2 * shaders: add explicit float/int type conversions, required for WebGL * shaders: specify mediump precision, required for WebGL * shaders: specify fragment shader output locations for WebGL * main: refactor handle_window_event to take a winit window, not glutin context * main: handle resize outside of handle_window_event since it updates the glutin window (the only event which does this) * main: use winit events in handle_window_event not reexported glutin events * main: refactor game loop handling into tick_all() * main: create winit window for WebGL, and use winit_window from glutin * main: restore console_error_panic_hook, mistakingly removed in (#260) * main: remove force setting env RUST_BACKTRACE=1, no longer can set env on web * www: index.js: fix wasm import path * www: npm update, npm audit fix * www: update readme to link to status on #446 🕸️ Web support



Now that graphics are implemented on top of glow (#262), support using WebGL through glow
Replace context creation through glutin with glow, when running on the web (keep using glutin for native). This fixes #171 failed to resolve: could not find
Contextinplatform_implReplace stdweb with web-sys, since stdweb is unsupported and web-sys is more complete.
Remove the std_or_web wrapper and localstoragefs because they depend on stdweb, will need to be rethought.This does not complete the web port (still doesn't run), but it gets closer