slint/examples/opengl_underlay
Olivier Goffart 58e5d62a02 Winit port: Fix wasm build
Port everything from instant to web-time
2023-10-23 14:22:48 +02:00
..
build.rs Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
Cargo.toml Winit port: Fix wasm build 2023-10-23 14:22:48 +02:00
CMakeLists.txt Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
index.html Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
main.cpp Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
main.rs Winit port: Fix wasm build 2023-10-23 14:22:48 +02:00
README.md xtask: Fix up license headers 2023-08-17 08:55:28 +02:00
scene.slint Update Slint logo folder with new design (#3432) 2023-09-11 16:41:06 +02: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().