Prefabricated shapes for the Glium OpenGL library.
The following shapes are currently provided by the library:
Documentation can be found here: http://jbrd.github.io/glium_shapes
Import the glium_shapes
crate:
extern crate glium_shapes;
Build a 2x3x4 Cuboid
with its centre-of-mass at the origin and draw it:
let cuboid = glium_shapes::cuboid::CuboidBuilder()
.scale(2.0, 3.0, 4.0)
.build(display)
.expect("Failed to build cuboid shape");
frame.draw(&cuboid, &cuboid, your_shader_program, your_uniforms, your_draw_params);
Examples for all shapes are provided. Just run:
cargo run --example axes
cargo run --example cuboid
cargo run --example quad
cargo run --example sphere
Each shape is constructed using a builder object, which provides methods for customising your new shape
By default, the geometry is constructed to suit the standard OpenGL context defaults:
By default, each shape is constructed with its centre-of-mass at the origin
Maintained but not actively developed. Will keep up-to-date with latest versions of rust and glium. Will add extra shapes when needed, and will happily accept contributions for extra shapes as well. Bugs will be fixed (please raise an issue if you find any!).
Contributions are most welcome! To reduce the feedback loop, please ensure you perform the following checks before contributing a patch:
cargo build
cargo build --release
cargo test
cargo fmt
should yield no changes)cargo clippy --all-targets
returns no warnings or errorscargo doc
succeedsJames Bird (@jbrd)