mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-18 19:22:18 +00:00
Add the graphics state enum to the callback, too. When we add support for different backends, it would be nice if it didn't require an API change. It's duplicated from Rust because it doesn't provide values. The WebLG one doesn't make sense for C++ and the proc address closure isn't ffi safe. (It could be manually bridged thought) |
||
|---|---|---|
| .. | ||
| build.rs | ||
| Cargo.toml | ||
| CMakeLists.txt | ||
| index.html | ||
| main.cpp | ||
| main.rs | ||
| README.md | ||
| scene.60 | ||
OpenGL Underlay Example
This example application demonstrates how layer two scenes together in a window:
- First a graphical effect is rendered using low-level OpenGL code (underlay).
- 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().