Update documentation for built-in renderers

This commit is contained in:
Richard 2021-11-10 19:20:16 -03:00
parent 01f67a2c1f
commit 46fb27b104
4 changed files with 102 additions and 3 deletions

View file

@ -45,7 +45,7 @@ The widgets of a _graphical_ user interface produce some primitives that eventua
Currently, there are two different official renderers: Currently, there are two different official renderers:
- [`iced_wgpu`] is powered by [`wgpu`] and supports Vulkan, DirectX 12, and Metal. - [`iced_wgpu`] is powered by [`wgpu`] and supports Vulkan, DirectX 12, and Metal.
- [`iced_glow`] is powered by [`glow`] and supports OpenGL 3.3+. - [`iced_glow`] is powered by [`glow`] and supports OpenGL 2.1+ and OpenGL ES 2.0+.
Additionally, the [`iced_graphics`] subcrate contains a bunch of backend-agnostic types that can be leveraged to build renderers. Both of the renderers rely on the graphical foundations provided by this crate. Additionally, the [`iced_graphics`] subcrate contains a bunch of backend-agnostic types that can be leveraged to build renderers. Both of the renderers rely on the graphical foundations provided by this crate.

View file

@ -34,7 +34,9 @@ Inspired by [Elm].
* First-class support for async actions (use futures!) * First-class support for async actions (use futures!)
* [Modular ecosystem] split into reusable parts: * [Modular ecosystem] split into reusable parts:
* A [renderer-agnostic native runtime] enabling integration with existing systems * A [renderer-agnostic native runtime] enabling integration with existing systems
* A [built-in renderer] supporting Vulkan, Metal, DX11, and DX12 * Two [built-in renderers] leveraging [`wgpu`] and [`glow`]
* [`iced_wgpu`] supporting Vulkan, Metal and DX12
* [`iced_glow`] supporting OpenGL 2.1+ and OpenGL ES 2.0+
* A [windowing shell] * A [windowing shell]
* A [web runtime] leveraging the DOM * A [web runtime] leveraging the DOM
@ -49,7 +51,10 @@ __iced is currently experimental software.__ [Take a look at the roadmap],
[Modular ecosystem]: https://github.com/hecrj/iced/blob/master/ECOSYSTEM.md [Modular ecosystem]: https://github.com/hecrj/iced/blob/master/ECOSYSTEM.md
[renderer-agnostic native runtime]: https://github.com/hecrj/iced/tree/master/native [renderer-agnostic native runtime]: https://github.com/hecrj/iced/tree/master/native
[`wgpu`]: https://github.com/gfx-rs/wgpu-rs [`wgpu`]: https://github.com/gfx-rs/wgpu-rs
[built-in renderer]: https://github.com/hecrj/iced/tree/master/wgpu [`glow`]: https://github.com/grovesNL/glow
[`iced_wgpu`]: https://github.com/hecrj/iced/tree/master/wgpu
[`iced_glow`]: https://github.com/hecrj/iced/tree/master/glow
[built-in renderers]: https://github.com/hecrj/iced/blob/master/ECOSYSTEM.md#Renderers
[windowing shell]: https://github.com/hecrj/iced/tree/master/winit [windowing shell]: https://github.com/hecrj/iced/tree/master/winit
[`dodrio`]: https://github.com/fitzgen/dodrio [`dodrio`]: https://github.com/fitzgen/dodrio
[web runtime]: https://github.com/hecrj/iced/tree/master/web [web runtime]: https://github.com/hecrj/iced/tree/master/web
@ -195,6 +200,32 @@ end-user-oriented GUI library, while keeping [the ecosystem] modular:
[`ggez`]: https://github.com/ggez/ggez [`ggez`]: https://github.com/ggez/ggez
[the ecosystem]: https://github.com/hecrj/iced/blob/master/ECOSYSTEM.md [the ecosystem]: https://github.com/hecrj/iced/blob/master/ECOSYSTEM.md
## Common problems
1. `Error: GraphicsAdapterNotFound`
This occurs when the selected [built-in renderer] is not able to create a context.
Often this will occur while using [`iced_wgpu`] as the renderer without
supported hardware (needs Vulkan, Metal or DX12). In this case, you could try using the
[`iced_glow`] renderer:
First, check if it works with
```console
$ cargo run --features "iced/glow iced/glow_canvas" --package game_of_life
```
and then use it in your project with
```toml
iced = { version = "0.3", default-features = false, features = ["glow"] }
```
**NOTE:** Chances are you have hardware that supports at least OpenGL 2.1 or OpenGL ES 2.0,
but if you don't, right now there's no software fallback, so it means your hardware
doesn't support Iced.
[built-in renderer]: https://github.com/hecrj/iced/blob/master/ECOSYSTEM.md#Renderers
## Contributing / Feedback ## Contributing / Feedback
Contributions are greatly appreciated! If you want to contribute, please Contributions are greatly appreciated! If you want to contribute, please
read our [contributing guidelines] for more details. read our [contributing guidelines] for more details.

17
docker/README.md Normal file
View file

@ -0,0 +1,17 @@
## Build
To use `cross` to compile for Raspberry Pi you first need to build the docker image.
Use these commands to build the images needed.
**NOTE:** Run these commands inside the `docker` folder. This is needed since `docker`
uses surrounding directories as "context" for building the image, which means it'll
copy the entire `target` directory.
### Raspberry Pi 2/3/4 (32 bits)
```
$ docker build -t iced-rs/armv7 -f Dockerfile.armv7-unknown-linux-gnueabihf .
```
### Raspberry Pi 3/4 (64 bits)
```
$ docker build -t iced-rs/aarch64 -f Dockerfile.aarch64-unknown-linux-gnu .
```

51
glow/README.md Normal file
View file

@ -0,0 +1,51 @@
# `iced_glow`
[![Documentation](https://docs.rs/iced_glow/badge.svg)][documentation]
[![Crates.io](https://img.shields.io/crates/v/iced_glow.svg)](https://crates.io/crates/iced_glow)
[![License](https://img.shields.io/crates/l/iced_glow.svg)](https://github.com/hecrj/iced/blob/master/LICENSE)
[![project chat](https://img.shields.io/badge/chat-on_zulip-brightgreen.svg)](https://iced.zulipchat.com)
`iced_glow` is a [`glow`] renderer for [`iced_native`]. This renderer supports OpenGL 3.0+ and OpenGL ES 2.0.
This is renderer is mostly used as a fallback for hardware that doesn't support [`wgpu`] (Vulkan, Metal or DX12).
Currently, `iced_glow` supports the following primitives:
- Text, which is rendered using [`glow_glyph`]. No shaping at all.
- Quads or rectangles, with rounded borders and a solid background color.
- Clip areas, useful to implement scrollables or hide overflowing content.
- Meshes of triangles, useful to draw geometry freely.
<p align="center">
<img alt="The native target" src="../docs/graphs/native.png" width="80%">
</p>
[documentation]: https://docs.rs/iced_glow
[`iced_native`]: ../native
[`glow`]: https://github.com/grovesNL/glow
[`wgpu`]: https://github.com/gfx-rs/wgpu
[`glow_glyph`]: https://github.com/hecrj/glow_glyph
## Installation
Add `iced_glow` as a dependency in your `Cargo.toml`:
```toml
iced_glow = "0.2"
```
__Iced moves fast and the `master` branch can contain breaking changes!__ If
you want to learn about a specific release, check out [the release list].
[the release list]: https://github.com/hecrj/iced/releases
## Current limitations
The current implementation is quite naive, it uses:
- A different pipeline/shader for each primitive
- A very simplistic layer model: every `Clip` primitive will generate new layers
- _Many_ render passes instead of preparing everything upfront
- A glyph cache that is trimmed incorrectly when there are multiple layers (a [`glyph_brush`] limitation)
Some of these issues are already being worked on! If you want to help, [get in touch!]
[get in touch!]: ../CONTRIBUTING.md
[`glyph_brush`]: https://github.com/alexheretic/glyph-brush