slint/examples/opengl_underlay
Simon Hausmann 5c3a98d0c9 C++: disable renderer-femto-wgpu feature by default
Just like with Rust.

This Fixes the C++ opengl_texture example. Also improve advice for C++ OpenGL examples to explicitly select the FemtoVG GL renderer

Fixes #8901
2025-07-11 09:43:57 +02:00
..
build.rs Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
Cargo.toml Bump version number to 1.13.0 2025-06-26 13:30:43 +00:00
CMakeLists.txt Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
index.html Wasm Demos: fix size of the canvas 2023-12-01 09:41:02 +01:00
main.cpp C++: disable renderer-femto-wgpu feature by default 2025-07-11 09:43:57 +02:00
main.rs Revamp BackendSelector API 2024-12-16 13:06:05 +01:00
README.md Update example readmes 2024-08-13 11:35:39 +02:00
scene.slint janitor: fix slint warning in example 2024-12-07 08:34:38 +01:00

OpenGL Underlay Example

This example application demonstrates how layer two scenes together in a window:

  1. First a graphical effect is rendered using low-level OpenGL code (underlay).
  2. A scene of Slint elements is rendered above.

This is implemented using the set_rendering_notifier function on the slint::Window type. It takes a callback as a parameter and that is invoked during different phases of the rendering. In this example the invocation during the setup phase is used to prepare the pipeline for OpenGL rendering later. Then the BeforeRendering phase is used to render the graphical effect with OpenGL. Afterwards, Slint will render the scene of elements into the same back-buffer as the previous OpenGL code rendered into.

Since the graphical effect is continuous, the code in the callback requests a redraw of the contents by calling slint::Window::request_redraw().

Screenshot of OpenGL Underlay