2 releases

0.6.7 Dec 10, 2023
0.6.6 Dec 10, 2023
0.1.0 Dec 10, 2023

#46 in Rendering

47 downloads per month

MIT/Apache

185KB
5K SLoC

Ombre

Une ombre est née, dans la lueur d'un ciel étoilé..

Synopsis

Ombre is a "New Jersey" style^0 library designed for games and graphics programming on the desktop.

It provides a thin layer of abstraction over the underlying context creation and graphics frameworks while keeping dependencies to a bare minimum, and trying to do the few things it does really well. Ombre also comes with support for various simple file formats that are designed to be easy encode and decode. This is in contrast to more popular formats like PNG and TTF which would likely call for external libraries.

Despite all of the above, Ombre is not meant as a "toy" library. Performance, stability, flexibility and developer friendliness are not compromised. Though certain defaults are chosen, such as the graphics backend, the user is able to easily swap out backends for something more appropriate to their target platform.

Features

  • Context creation and input handling using glfw^1
  • Graphics API inspired by sokol-gfx^2
  • Cross-platform using an OpenGL 3.3 backend with glow^3
  • Bitmap font rendering support for UF1 and UF2 fonts^4
  • Image encoding and decoding using the simple RGBA (.rgba) file format
  • Computer graphics math module with 2D and 3D vectors and transforms
  • Color types and functions

Rationale

  • Since all major platforms support OpenGL 3.3, and will do for the foreseable future, there is no reason to target anything else. The glow crate is used for its simplicity, portability, and bare-bones type safety.
  • For context creation and input handling, GLFW is chosen for its maturity and stability, while staying minimal and offering the most flexibility without taking away control from the user.
  • Popular font and image formats such as TTF and PNG are explicitly not supported due to their complexity and low value-add.
  • 3D math is implemented in-house, to avoid depending on yet another abandonned math library, and to offer the best experience.
  • Trying to support all platforms including web and mobile with a single API is bound to leak platform details. We avoid that by focusing on OpenGL and desktop graphics.

Acknowledgments

Big chunks of this library were adapted from miniquad by Fedor Logachev, which itself is adapted from sokol, by Andre Weissflog. Additionally, much of the 3D math code was borrowed from cgmath, and euclid by the Servo Project Developers. Finally it's worth mentioning that druid, by Raph Levien has served as inspiration for the UI code, and some of the math code.

License

Dual-licensed under MIT and Apache.

Dependencies

~4–13MB
~154K SLoC