Git Product home page Git Product logo

rustkit's People

Contributors

wolfiewerewolf avatar

Watchers

 avatar  avatar

rustkit's Issues

Commit: b50246c75d51bdacdc0398a5e44cbe10c9865564

I'm starting to add some basic functionality to the example like loading assets, in particular, GLSL. A lot of engines will use GLSL Generators and provide a fixed set of uniforms and attributes and while that may be something to do later for the most common stuff, for now, I simply want to be able to load arbitrary GLSL and hack around with it.

I've always used XHR for this kind of thing in the browser.

Fortunately Emscripten provides the "fetch" api which also works in rust. I found the following tutorial:
https://qiita.com/_likr/items/71817953b237a32a3015
The tutorial itself is complete and works but if I were writing it I would have called out this particular point:

"build": "EMMAKEN_CFLAGS=\"-s FETCH=1\" cargo build --target=wasm32-unknown-emscripten --release"

The EMMAKEN_CFLAGS are necessary in order to link the fetch api with the Emscripten build.. it's discussed here:
emscripten-core/emscripten#5063
So I've updated the package.json to include the build command line. It will be necessary to build this commit as follows:

npm run-script build

I also found that this only works with the wasm32-unknown-emscripten target. Whenever I attempt to use the flags with asmjs the flags seem to be ignored.

So far I've implemented the tutorial only but the intention is to use the fetch api to load glsl. I was initially going to jump straight into porting over an example from webgl2Fundamentals and then decided a more simple test would be to just load the existing shaders, parse them, and attempt to use them first. So that's what I'll do next. Once that works I'll see about re-producing the webgl fundamentals example which is included in the JS folder as javasript. If you uncomment the JS Test section in index.html and comment out the WASM loader you can see it for yourself.
I am most interested in seeing what kind of performance differences, if any, there are between the WASM vs JS versions...

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.