OpenGL Overview
How LVGL's OpenGL support fits together on Linux: which display drivers create a context, which draw units render on the GPU, and how the two combine.
Overview
OpenGL is a cross-platform, hardware-accelerated graphics API, and OpenGL ES is the subset designed for embedded and mobile hardware. LVGL uses it on Linux for three reasons: to offload rendering to the GPU, to embed LVGL content inside existing OpenGL applications, and to render 3D content.
LVGL's OpenGL support comes in two halves, and you generally need one of each:
- Display drivers create and own the OpenGL context, and put the finished frame on screen.
- Draw units do the actual rendering with OpenGL instead of the CPU.
Enabling a driver with an OpenGL backend but no GPU draw unit is valid and sometimes what you want, LVGL can then render using software and use OpenGL to present the result to the display.
Drivers That Create a Context
These drivers create and manage an OpenGL context for you:
| Driver | How to get the OpenGL path |
|---|---|
| DRM | LV_LINUX_DRM_BACKEND_EGL |
| Wayland | LV_WAYLAND_USE_EGL |
| SDL | LV_SDL_BACKEND_EGL |
| GLFW | Always |
Every one of them except GLFW uses EGL underneath.
GLFW and EGL are mutually exclusive
LV_USE_GLFW cannot be combined with LV_USE_EGL
The OpenGL Driver can be used to embed LVGL in an application that already owns the context.
Draw Units
| Draw unit | Notes |
|---|---|
| NanoVG | Recommended. Rasterizes on the GPU, best performance and widest feature coverage |
| OpenGL ES | Caches software-rendered areas as GPU textures. Slower, fewer features. |
3D and glTF
The glTF module loads and renders 3D models per the glTF 2.0 specification, with PBR materials, animations and camera control. It needs OpenGL ES 2.0 with some extra extensions.
3D support comes from the GL renderers so a GPU draw unit is required.
For details, see glTF.
See Also
- NanoVG Draw Unit - the recommended GPU renderer
- EGL - the layer under most OpenGL paths on Linux
- DRM - production driver with an EGL backend
- GLFW - quickest OpenGL setup for development
- OpenGL Driver - embedding LVGL in an existing context
- glTF - 3D model rendering
Last updated on
Embedded Linux Support
LVGL runs as a native Linux application and supports a wide range of display backends, input systems, rendering accelerators, and Linux distributions out of the box.
Drivers
LVGL's Linux drivers come in two kinds: display drivers that put pixels on a screen, and input drivers that read touch, mouse and keyboard events. Most setups need one of each.