Expand description
Helpers for enabling ANGLE support of the ZNG apps on Windows.
The default ZNG view-process implementation will attempt to dynamically load ANGLE DLLs if requested, this crate helps signal the view-process and acquire the DLLs.
The following is a minimal setup example:
First add the crate dependency, ZNG only supports ANGLE on Windows so the dependency can be conditional.
[target.'cfg(windows)'.dependencies]
zng-view-angle = { version = "0.1.5", features = ["download"] }With the "download" feature enabled the crate will download the required ANGLE DLLs from zng-ui/build-angle
and copy them to the output dir. Its only two files libEGL.dll and libGLESv2.dll, around 5MB total, you must
ensure these files are packaged with the app installer.
Second signal the view-process to use ANGLE:
use zng::prelude::*;
fn main() {
zng::env::init!();
APP.defaults().run_window(async {
#[cfg(windows)]
{
zng_view_angle::register_license();
zng_view_angle::register_root_extender();
}
Window! {
// ...
}
});
}The register_root_extender will insert a node in all subsequent windows that signals the view-process to
find and use the ANGLE DLLs when render mode uses the GPU. If the DLLs are not found the native OpenGL driver is used instead.
The register_license simply adds the ANGLE BSD3-Clause license to the LICENSES service.
§Crate
This crate is part of the zng project.
§Cargo Features
This crate provides 1 feature flag, not enabled by default.
§"download"
Download ANGLE DLLs and copy to output dir on build
Functions§
- prefer_
angle_ egl PSignal the view-process to try and use EGL for this window when the ANGLE DLLs can be found and the render mode is not software.- register_
license - Register the ANGLE license with the
LICENSESservice. - register_
root_ extender - Enable ANGLE for all subsequent open windows.