• Stars
    star
    1,073
  • Rank 43,114 (Top 0.9 %)
  • Language
    Rust
  • License
    Other
  • Created almost 9 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Type-safe, type-level and stateless Rust graphics framework

luminance logo

luminance, the safe, type-driven, multi-backend and simple graphics crate

Build Status] docs.rs crates.io License Matrix room

History

luminance is an effort to make graphics rendering simple and elegant. It was originally imagined, designed and implemented by @phaazon in Haskell (here) and eventually ported to Rust in 2016. The core concepts remained the same and the crate has been slowly evolving ever since. At first, used only by @phaazon for his Rust demoscene productions (example here and here, using spectra) and a bunch of curious peeps, it now has more visibility among the graphics ecosystem of Rust.

Currently, that ecosystem is spread into several crates, ideas and people. It is highly recommended to read the great article about the ecosystem by @Icefoxen, here.

However, luminance is a bit different from what it was initially imagined for. People are looking for an easy-to-use crate, with good abstractions and safe-guards against all the bad and dangerous graphics API caveats. luminance has always been about providing a safe, type-safe and elegant API (being Haskell-based makes it heavily use the type system, for instance) but it now has a more unique niche in the ecosystem. Where gfx-hal provides an experience focused on down-to-metal performance and an API very similar to Vulkan’s, luminance provides an API that is, for sure, a bit higher-level, and not Vulkan-based — and hence, yes, it likely won't give you the same performances as with gfx-hal (though no benchmarks have been done so far) — but easier to start with, especially if you don’t already have a background experience with OpenGL or Vulkan.

The strengths of luminance are:

  • Easy to learn: the concepts, based on OpenGL, are applied to graphics, not general-purpose programming on GPU. Using luminance will help you wrap your fingers around what graphics programming is about and it will help you, perhaps, to jump to lower abstractions like gfx-hal, if you ever need to.
  • Performant: by using Rust and being designed around the concept of good performances, luminance should allow you to build nice and fast simulations, animations and video games. Remember that games you played years ago didn’t have Vulkan and were impressive nonetheless. It’s unlikely you will get 100% out of your GPU by using luminance since it’s built over technologies that are not using 100% of your GPU. Unless you need and know exactly why you need 100% of your GPU, you should be just fineâ„¢.
  • Elegant: the design is heavily based on functional programming concepts such as typeclasses, associated types, singleton types, existentials, contravariant resources, procedural macros, strong typing, etc. Plus, every bit of possible stateful computations is hidden behind a system of smart state, removing the need to worry about side-effects. luminance still has mutation (unless its Haskell version) but the Rust type system and borrow checker allows for safe mutations.
  • Modern: the whole luminance ecosystem tries its best to stay up-to-date with Rust evolutions and features. On the same level, the underlying technologies are kept up-to-date and might even be replaced if modern, better-suited alternatives emerge (similarly, Vulkan support might eventually get added, though there are no immediate plans to do so).
  • Opinionated enough: a big bet with luminance was to make it opinionated, but not too much. It needs to be opinionated to allow for some design constructs to be possible, optimize performance and allow for extra safety. However, it must not be too opinionated, lest it become a framework. luminance is a library, not a framework, meaning that it will adapt to how you think you should design your software, not the other way around (within the limits of safe design). luminance won't tie your hands.

The luminance ecosystem

It is currently composed of several different crates:

Core crates

  • luminance: the core crate, exposing a graphics API that aims to be easy to learn, safe, type-safe, stateless and fun!
  • luminance-derive: a companion crate to luminance you’re very likely to enjoy; it will help you derive important traits for your application or library to work. You should definitely invest some time in the documentation of this crate; it’s easy and well explained.
  • luminance-front: a front facing set of luminance re-exports to make it easy to use the library as a end-user developer by picking a backend type at compile-time, most of the time based on your compilation target.

Backend crates

  • luminance-gl: a crate gathering OpenGL backends. Several versions might be supported.
  • luminance-webgl: a crate gathering WebGL backends. Several versions might be supported.

Platform crates

Other crates

  • luminance-std140: a crate useful to backend crates based on Khronos / OpenGL’s std140.
  • examples: a combination of examples to show off some features / techniques.

Learning

luminance has two main and official resources to learn:

  • The book. It contains various chapters, including tutorials and onboarding newcomers. It will not provide you with the best description of a given feature as it focuses more on the overall comprehension and explaining than code directly. It also fits people who don’t know anything about rendering.
  • The examples. They are like unit tests: each introduces and focuses on a very specific aspect or feature. You should read them if you are interested in a specific feature. They’re not well suited to learn from scratch and they are weaker than a structured tutorial but more concise. They also provide functional tests as the backend-agnostic architecture allow to very easily add new tests.

You should try both ways and see which one fits the best for you!

Contributing

Please read the CONTRIBUTING document.

Dependent projects

Those projects use luminance:

Licenses

luminance is licensed under BSD-3-Clause and the logo is under CC BY-ND.

More Repositories

1

hop.nvim

Neovim motions on speed!
Lua
2,121
star
2

mind.nvim

The power of trees at your fingertips.
Lua
704
star
3

this-week-in-neovim-contents

Contents of weekly news delivered by this-week-in-neovim.org.
261
star
4

warmy

Hot-reloading loadable and reloadable resources
Rust
210
star
5

this-week-in-neovim.org

this-week-in-neovim.org official webapp repository
Rust
183
star
6

glsl

GLSL parser for Rust
Rust
180
star
7

splines

Interpolation made easy.
Rust
131
star
8

spectra

Rust demoscene engine (currently on hold)
Rust
124
star
9

luminance

Type-safe, type-level and stateless Haskell graphics framework
Haskell
110
star
10

shades

Rust EDSL for shading languages
Rust
66
star
11

config

My main configuration files
Lua
65
star
12

cargo-sync-readme

Generate a Markdown section in your README based on your Rust documentation
Rust
55
star
13

toodoux

A task manager based on taskwarrior
Rust
51
star
14

mind

The power of trees at your fingertips
Rust
42
star
15

notisys.nvim

System-wide notifications for Neovim
Lua
40
star
16

do-notation

The Haskell’s do notation brought to Rust
Rust
39
star
17

cheddar

The Cheddar GLSL superset language
Rust
27
star
18

spline-editor

A simple spline editor for the splines crate
Rust
24
star
19

wavefront

Haskell Wavefront OBJ loader library
Haskell
19
star
20

bidule

Very simple and Rust FRP crate
Rust
18
star
21

poesie.nvim

Lua
16
star
22

stack-haddock-upload

A little script to upload documentation to Hackage within a stack-powered project
Shell
14
star
23

learn-luminance

11
star
24

luminance-gl-rs

DEPRECATED luminance-gl has been moved into https://github.com/phaazon/luminance-rs
Rust
11
star
25

celeri-remoulade

The Undead Sceners PC demo for Evoke 2016
Rust
10
star
26

smoothie

Smooth curves via several interpolation modes
Haskell
10
star
27

advent-of-code-2k18

https://adventofcode.com/2018
Rust
9
star
28

phaazon.net

Source code of phaazon.net.
Rust
8
star
29

kak-tree-sitter

tree-sitter meets Kakoune
Rust
8
star
30

try-guard

A guard! macro inspired by the guard Alternative function from Haskell.
Rust
6
star
31

luminance-samples

Luminance samples
Haskell
6
star
32

monad-journal

Pure logger typeclass and monad transformer
Haskell
6
star
33

outline-2017-invitro

Outline 2017 Invitation, by DESiRE and The Undead Sceners (code by @phaazon)
Rust
6
star
34

quaazar

Realtime 3D engine
Haskell
6
star
35

pixels-of-life

A GPU accelerated version of Conway’s Game of Life
Rust
5
star
36

save-z0r

Because those loops are too epic to let them go!
Rust
5
star
37

hsFModEx

FModEx Haskell API. Discontinued.
Haskell
4
star
38

hid

Haskell interface to hidapi
Haskell
4
star
39

any-cache

Cache with any key and any associated value
Rust
4
star
40

zero

Semigroups with absorbing element
Haskell
4
star
41

lightning-road-to-liquid-radiator

Official source code of Lightning Road To Liquid Radiator
C++
4
star
42

lqducul

Rust
4
star
43

cheddar-edit

A shader-toy-like project that aims to shader rapid prototyping
Rust
4
star
44

msi-kb-backlit

A command line tool to change backlit colors of your MSI keyboard
Haskell
3
star
45

reactant

FRP Haskell library
Haskell
3
star
46

non-empty

Efficient non-empty vectors in Rust
Rust
3
star
47

al

Haskell OpenAL raw binding
Haskell
3
star
48

glsl-quasiquote

The glsl! procedural macro for the glsl crate.
3
star
49

awoo

Rust
3
star
50

html-entities

Rust html entities utility functions
Rust
2
star
51

brainfarts

Pets de cerveaux.
2
star
52

kwak

The (in)famous bot you all love on IRC! (see her in action in #demofr@freenode)
Rust
2
star
53

luminance-windowing

Common windowing code for luminance (not an actual backend)
2
star
54

event

Monoidal, monadic and first-class events.
Haskell
2
star
55

par-soeur

Run away, nothing to see here!
Rust
2
star
56

advent-of-code-2021

https://adventofcode.com/
Rust
2
star
57

luminance-glutin

glutin support for luminance
Rust
2
star
58

proc-macro-faithful-display

A more faithful Display for proc-macro token types.
Rust
2
star
59

thunk

Some research project of mine about sharing thunks in Rust
Rust
2
star
60

tellbot

IRC bot with account simple tasks and tells function
Haskell
2
star
61

inject-function

Haskell package that lets you write regular functions with the extra feature to be able to inject parameters that can be shared over function composition
Haskell
2
star
62

leaf

A simple portfolio generator
Haskell
2
star
63

rust-gl-toy

As I’m learning rust, let’s play with OpenGL and GLFW here ;)
Rust
1
star
64

igl

Indexed OpenGL; a safer OpenGL implementation
Haskell
1
star
65

algo

Some famous algorithms, written with fun
Rust
1
star
66

conal_frp

An experiment at implementing FRP as described by its father, Conal Elliott. Paper here http://conal.net/papers/push-pull-frp/push-pull-frp.pdf
Haskell
1
star
67

heat-station

Official source code of Heat Station
C++
1
star
68

chronos

Simple FRP timeline. Designed to be used for demoscene purposes
Haskell
1
star
69

luminance-glfw

GLFW support for luminance
1
star
70

skp

skp D framework
D
1
star
71

advent-of-code-2020

Haskell
1
star
72

gltf

Haskell GLTF loader
Haskell
1
star
73

aur

All packages I maintain in AUR
Shell
1
star
74

codingame-unleash-the-geek

My contribution to Unleash The Geek (started on 7th of October 2019)
Rust
1
star
75

meta

Demoscene framework
Perl
1
star
76

fractalis

A Mandelbrot fractal viewer
C
1
star
77

leetify

Leetify some text!
Haskell
1
star
78

agui

Abstract GUI
Haskell
1
star
79

impersonate

An experimental Markov chain generator that learns how to speak as if it was someone else.
Rust
1
star
80

sdffont

A tool that generates signed distance fields fontmap from font file (.ttf, and so on).
Haskell
1
star
81

hush

Demoscene soft synthesizer designed to be embedded in intros.
Rust
1
star
82

iutbx1-ds

IUT Bordeaux 1 Dimitri Sabadie official repository
C++
1
star
83

atoi-data-dependency

A short and fun study of data dependency and compiler optimizations
Rust
1
star
84

rcpp

A Rust implementation of the C Preprocessor
Rust
1
star
85

colorscheme-gen

A little tool to generate color scheme for urxvt session and using the Text Export option of the colorscheme web site.
Shell
1
star
86

phraskell

Fractal set viewer.
Haskell
1
star
87

blog

phaazon.net blog articles
1
star
88

advent-of-code-2022

Advent of Code 2022 solutions
Rust
1
star