#stateless #type-safe #graphics #luminance

luminance-front

luminance re-exported with a backend picked at compile-time

10 releases (5 breaking)

Uses new Rust 2021

0.6.0 Dec 31, 2021
0.5.0 Nov 26, 2021
0.4.0 Jun 29, 2021
0.3.1 Oct 27, 2020
0.1.0 Jul 16, 2020

#382 in Graphics APIs

Download history 21/week @ 2021-10-07 24/week @ 2021-10-14 36/week @ 2021-10-21 17/week @ 2021-10-28 28/week @ 2021-11-04 3/week @ 2021-11-11 16/week @ 2021-11-18 36/week @ 2021-11-25 33/week @ 2021-12-02 22/week @ 2021-12-09 15/week @ 2021-12-16 7/week @ 2021-12-23 38/week @ 2021-12-30 21/week @ 2022-01-06 29/week @ 2022-01-13 28/week @ 2022-01-20

117 downloads per month

BSD-3-Clause

390KB
7K SLoC

luminance-front

luminance, but with a backend type picked at compile-time.

This crate re-exports aliases to all luminance types, methods, and any kind of symbols requiring a backend type variable (typically written B) by selecting the proper type based on the platform you target and/or feature flags. Selection is done mainly automatically in the Cargo.toml file, and can customize on a per-target basis which backend you want to select.

Important note: the existence of this crate was made a need so that people who don’t care about genericity can start using luminance without having to worry about backend implementations. It’s the case for people writing small binaries, “final” graphics libraries and/or 2D/3D/animation engines, etc. If you are writing a luminance middleware, please stick to the luminance crate and its polymorphic types.

Some symbols are re-exported even though they are not polymorphic in a backend type variable in luminance. That is only for convenience purposes.

Documentation

Because this crate re-exports the content of luminance, you are strongly advised to go read the documentation on luminance. Documentation will not be duplicated here.

How to setup

For a starter experience, you have nothing specific to do: simply add luminance-front as a direct dependency and you should be good to go:

[dependencies]
luminance-front = ""

This will select a default backend implementation for the target you currently compile for. See the list of features below for further information.

To switch target to use, you are advised to either put a .cargo/config file in a directory inside your project, or compile with the --target option.

The default setup will provide a default implementation that should work great on as many machines as possible for all supported targets. If for some reason you want to pick another implementation (for instance an older version of WebGL, OpenGL or an experimental, more modern implementation), you will have to use specific platform features, such as "gl33".

[dependencies]
luminance-front = { version = "", no-default-features = true, features = ["gl33", "webgl2"] }

As you can see, you can specify features for different targets at the same time. Target features are checked in the lib.rs, so it’s possible to define both OpenGL and WebGL features at the same time. The current target will narrow down which one to use.

List of features

  • Default: ["gl33", "webgl2"].
  • OpenGL:
    • "gl33": OpenGL 3.3 implementation.
  • WebGL 2:
    • "webgl2": WebGL 2 implementation.

Dependencies

~0–1.2MB
~24K SLoC