[][src]Crate glium_shapes

Prefabricated shapes for the Glium OpenGL library.

Building a shape

Each shape is constructed using a builder object. The builder objects allow us to customise the resultant shape.

In the following example, we use a CuboidBuilder to construct a 2x3x4 Cuboid with its base at the origin:

This example is not tested
let cuboid = glium_shapes::cuboid::CuboidBuilder::new()
             .translate(0.0, 0.5, 0.0)
             .scale(2.0, 3.0, 4.0)
             .expect("Failed to build cuboid shape");

Drawing a shape

All of the shapes provided in this library are a source of both vertices and indices, such that you can pass them directly to the glium::Surface::draw method like so:

This example is not tested
frame.draw(/*vertices=*/&cuboid, /*indices=*/&cuboid, program, uniforms, params);

The shader program, uniform buffers, and draw parameters are not provided by this library.



A module for constructing axes locator shapes.


A module for constructing cuboid shapes.


A module containing the error structures for this crate.


A module for constructing polygonal quad shapes.


A module for constructing sphere shapes.


A module containing the vertex structure shared across all shapes.