Crate candelabre_windowing

Source
Expand description

§Welcome!

The purpose of this crate is to provide a way to easily handle windows, just one or a multitude of them. After creating the window, it’s simple to use the candelabre-core and candelabre-widget to quickly construct a beautiful GUI.

§A bit of history

At the beginning, this crate was designed to use glutin v0.22 with luminance, but due to some foolish idea from the developper, the initial goal slide a bit. Now the purpose of candelabre-windowing is mostly to support candelabre-widget, but you can still use it solely with gl, rgl, or any lib who play with OpenGL.

§What’s inside this crate?

This crate provide a two elements:

  • CandlSurface, a window type who generate a surface for using OpenGL
  • CandlManager, a window manager to enable using multiple windows in a single application / thread
  • CandlWindow, a trait on which CandlSurface is based on

§CandlSurface

Core of this lib, it’s a simple way to get an OpenGL context and then use luminance luminance. Initially it’s a copy of luminance-glutin lib, modified to be able to work with the CandlManager.

§CandlManager

When dealing with multiple windows in a single application, it quickly become complex and error prone. You can only use one OpenGL context at a time, and must so you need to swap between each contexts when you update what you display. With CandlManager, you have what you need to help you in this tedious task. It take the responsability to make the swap for you, and track each window you link to it.

§CandlWindow

This trait was added to let developpers create their own implementation of CandlSurface, like using luminance to handle the OpenGL context, or get rid of the stateful capability of the CandlSurface. If an application need a simple way to handle a window, maybe the CandlWindow is the right tool to do it.

§About state in CandlSurface and CandlManager

It’s possible to add state into the CandlSurface and the CandlManager. The purpose of this state is to handle all the OpenGL data in a structure inside the surface, and enable a direct access between the renderer and the state of the surface. In the examples, it works a little bit like a FRP, with the state acting like a store to handle a model, pass to the renderer. Take a look.

Re-exports§

Structs§

Enums§

Traits§