slint/examples/opengl_underlay
Simon Hausmann 29804f34de Fix WASM version of OpenGL underlay example
Commit 3cb636169506262d96ec2bc53a617714d5ab068d in femtovg switched to
using WeblGL to (needed for tiling). This means the GraphicsAPI::WebGL
context type needs to be updated, too. Also, the canvas_id was always
empty, but needs to be initialized from the id of the element we're
using.
2024-09-24 10:47:15 +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.8.0 2024-08-15 12:44:46 +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 Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
main.rs Fix WASM version of OpenGL underlay example 2024-09-24 10:47:15 +02:00
README.md Update example readmes 2024-08-13 11:35:39 +02:00
scene.slint cleanup examples according to upcoming code guidelines (#3809) 2023-11-02 11:04:40 +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