luminance-front

Crates.ioluminance-front
lib.rsluminance-front
version0.6.1
sourcesrc
created_at2020-07-16 17:39:40.584716
updated_at2022-04-13 06:41:54.379519
descriptionluminance re-exported with a backend picked at compile-time
homepagehttps://github.com/phaazon/luminance-rs
repositoryhttps://github.com/phaazon/luminance-rs
max_upload_size
id265845
size16,230
Dimitri Sabadie (hadronized)

documentation

https://docs.rs/luminance-front

README

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.
Commit count: 1990

cargo fmt