1.14.0.5
Hummingbird
A modern user interface library for games
Rendering Architecture

Table of Contents

Hummingbird draws the UI (a View) in a user-provided texture. This happens by calling cohtml::ViewRenderer::SetRenderTarget. The texture must have 4 color channels and depth and stencil buffers attached. On OpenGL, a complete framebuffer must be passed with all its attachments set.

Hummingbird performs incremental rendering by updating only the parts of the UI texture that have changed. It will not redraw everything in the UI, which improves performance significantly. The user should not draw anything on the UI texture except the output of Hummingbird. Internally Hummingbird uses the Coherent Labs Renoir graphics library.

Hummingbird asynchronously records rendering commands that are later executed in the render thread when calling cohtml::ViewRenderer::Paint(). This method draws the new frame if one was recorded or returns immediately if nothing in the UI has changed.

This is the reason every View object has a corresponding ViewRenderer. The View lives on the main thread and "controls" the page, while the ViewRenderer is only in charge of drawing it and lives on the render thread.

Backends

On different platforms, Hummingbird can draw with different rendering APIs. The API specific code is encapsulated in a Renoir backend. The application can also define its own rendering backend that uses the graphics facilities it has or modify the existing backends provided in the Hummingbird package.

The backend is registered and used with a call to cohtml::SystemRenderer::RegisterRenderThread. This call tells Hummingbird which is the render thread and what backend to use during View rendering.

The backends themselves are objects that implement the renoir::RendererBackend interface. The backends provided in the Hummingbird package can be used as a starting point for modification or for implementing new backends.

Hummingbird comes with the following backends:

  • DirectX 9
  • DirectX 11
  • DirectX 11 x - Fast Semantics
  • DirectX 12
  • OpenGL 3.3+
  • OpenGL ES 2
  • OpenGL ES 3
  • libGNM
  • [Planned] Metal
  • [Planned] Vulkan