minwebgl

Crates.iominwebgl
lib.rsminwebgl
version0.2.0
sourcesrc
created_at2024-09-10 07:09:50.758928
updated_at2024-10-28 12:06:29.388136
descriptionMinimal set of tools for concise WebGL programming
homepage
repositoryhttps://github.com/Wandalen/cg_tools
max_upload_size
id1370119
size196,878
Wandalen (Wandalen)

documentation

README

minwebgl

Minimal set of tools for concise WebGL programming.

Implemented Features

  • Attributes Uploading
  • Matrices in Attributes Uploading, row-major
  • Instanced Rendering
  • Uniforms Buffer Objects
  • Vertex Array Objects

Installation and running

To use this library, you'll need to compile you application to wasm and then use it from javascript.

Wasm-pack

You can use wasm-pack:

rustup target add wasm32-unknown-unknown  #Install wasm toolchain for rust
cargo install wasm-pack #Install wasm-pack
wasm-pack build --target web #Build your app for plain use on the web

--taget web option will allow you to load your code in a browser directly( in plain HTML ). You can mark your main function with #[wasm_bindgen(start)]`` And then use it in html:

<script type="module">
    import init from "./pkg/you_crate_name.js";
    init();
</script>

Trunk

Another way is to use trunk - a WASM web application bundler for Rust.

rustup target add wasm32-unknown-unknown  #Install wasm toolchain for rust
cargo install trunk #Install truck
trunk serve --release #Build and run your server in release mode

Any files you want to load in your project have to lie in a 'static' directory, relatively to the index.html file.
When using trunk you can specify the following, if your file lie elsewhere

<link data-trunk rel="copy-dir" href="assets/" data-target-path="static"/>
Commit count: 0

cargo fmt