slint/examples/opengl_underlay
Simon Hausmann 015a06e2ff Fix up links for the opengl underlay HTML
Don't link to the .60 file, that's not interesting. Link to the directory with the Rust and C++ source code
2022-02-07 11:39:44 +01:00
..
build.rs Add a Rust example that demonstrates GL rendering under a scene 2022-02-04 15:41:53 +01:00
Cargo.toml Add a Rust example that demonstrates GL rendering under a scene 2022-02-04 15:41:53 +01:00
CMakeLists.txt Add a Rust example that demonstrates GL rendering under a scene 2022-02-04 15:41:53 +01:00
index.html Fix up links for the opengl underlay HTML 2022-02-07 11:39:44 +01:00
main.cpp Minor fixup to the C++ rendering notifier API 2022-02-07 08:50:09 +01:00
main.rs Add a Rust example that demonstrates GL rendering under a scene 2022-02-04 15:41:53 +01:00
README.md Add a Rust example that demonstrates GL rendering under a scene 2022-02-04 15:41:53 +01:00
scene.60 Add a Rust example that demonstrates GL rendering under a scene 2022-02-04 15:41:53 +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 SixtyFPS elements is rendered above.

This is implemented using the set_rendering_notifier function on the sixtyfps::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, SixtyFPS 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 sixtyfps::Window::request_redraw().