Git Product home page Git Product logo

glium_shapes's Introduction

glium_shapes

Crates.io TravisCI

Prefabricated shapes for the Glium OpenGL library.

The following shapes are currently provided by the library:

  • Axes
  • Cuboid
  • Quad
  • Sphere

Documentation

Documentation can be found here: http://jbrd.github.io/glium_shapes

Getting Started

  • 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

Technical Details

  • 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:

    • Right-handed coordinate system (x = right, y = up, z = out of screen)
    • Front-faces taken to be counter-clock-wise
  • By default, each shape is constructed with its centre-of-mass at the origin

Development Status

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!).

Contributing Patches

Contributions are most welcome! To reduce the feedback loop, please ensure you perform the following checks before contributing a patch:

  • Ensure the project builds in debug: cargo build
  • Ensure the project builds in release: cargo build --release
  • Ensure the tests pass: cargo test
  • Ensure the coding style is consistent (cargo fmt should yield no changes)
  • Ensure cargo clippy --all-targets returns no warnings or errors
  • Ensure cargo doc succeeds
  • Ensure all the examples build and run successfully
  • Ensure your name is added to the contributors list in README.md

Contributors

James Bird (@jbrd)

glium_shapes's People

Contributors

jbrd avatar

Stargazers

 avatar  avatar  avatar  avatar

glium_shapes's Issues

Update to glium = "0.30.2"

Hello. Nice crate. Donno if You are still updating this lib, but since no messages can be found about that on the readme, I've decided to open this issue.

I'm trying to run the code bellow:

let cuboid = glium_shapes::cuboid::CuboidBuilder::new();
            cuboid.scale(2.0, 3.0, 4.0)
            .translate(0.0, 1.5, 0.0)
            .build(display)
            .expect("Failed to build cuboid shape");

But I get this error :

mismatched types expected reference, found struct `glium::Display`

So I add & to fix it and I get this other error :

the trait bound `glium::Display: glium::backend::Facade` is not satisfied

the trait `glium::backend::Facade` is not implemented for `glium::Display`

note: perhaps two different versions of crate `glium` are being used?rustc(E0277)
app.rs(246, 20): the trait `glium::backend::Facade` is not implemented for `glium::Display`

Perhaps a new updated to glium_shapes is needed?

To make things easier, I found at tomaka/glium_text#18 almost the same problem. I'm guessing some breaking changes happened.

I'll clone your crate and try to fix, but I really don't know what to do right now and if things will work it out.

But, hey! Thanks for the crate .

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.