OpenGL ES Draw Unit

The OpenGL ES draw unit caches software-rendered areas as GPU textures and composites them with OpenGL ES, avoiding redraws of content that has not changed.

Edit on GitHub

Overview

The OpenGL ES draw unit renders widgets in software, caches the result as an OpenGL texture, and composites those textures on the GPU. Whenever a later frame asks for something already in the cache, the texture is reused instead of redrawn, which is most of the screen, most of the time, in a typical UI.

That makes it fast for static and slowly-changing content, and slower than software rendering for content that changes every frame.

Prefer NanoVG

NanoVG is the recommended GPU renderer on Linux: it performs better and supports more LVGL features. Reach for this draw unit when you specifically want the texture cache, or when NanoVG's limitations do not suit you.

Requirements

  • OpenGL ES 2.0 or newer
  • An OpenGL context, created by one of the display drivers listed in OpenGL Overview or by your own code

Configuration

Enable LV_USE_DRAW_OPENGLES

Options

SymbolDefaultMeaning
LV_DRAW_OPENGLES_TEXTURE_CACHE_COUNT64Number of textures kept in the cache. More entries mean fewer redraws but more GPU memory.

Limitations

  • No gain without cache hits. Performance is worse when drawn areas are never found in the cache, e.g. widgets whose color or shape changes every frame
  • Layer transparency. Layers that have both transparent pixels and an overall layer opacity do not blend correctly
  • No layer rotation. Rotated layers are unsupported. Rotated images are fine.

NanoVG has none of these limitations.

See Also

Last updated on

On this page