Skip to content
This repository has been archived by the owner on Jun 18, 2021. It is now read-only.

Commit

Permalink
Add screenshots of examples
Browse files Browse the repository at this point in the history
When looking into wgpu-rs as a replacement for WebGL I went to the
examples directory on GitHub to browse for a bit.

I wanted to see some of the examples at a glance without needing to
clone the repository.

This commit enables that by adding a README to each example with a
description of the example and screenshots / example output.

In a few cases the description is a bit redundant - but my hope is that
in the future we can improve all the READMEs.

Being a web API and thus very accessible, WebGPU could end up being many
people's first introduction to graphics programming so the lower we make
the barrier the better.
  • Loading branch information
chinedufn authored and grovesNL committed Apr 26, 2020
1 parent c0b09be commit 309cc1c
Show file tree
Hide file tree
Showing 20 changed files with 151 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ Cargo.lock
# Other
.DS_Store

# VSCode project
# IDE/Editor configuration files
.vscode
.idea

# Output from capture example
red.png
13 changes: 13 additions & 0 deletions examples/boids/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# boids

Flocking boids example with gpu compute update pass

## To Run

```
cargo run --example boids
```

## Screenshots

![Boids example](./screenshot.png)
Binary file added examples/boids/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions examples/capture/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# capture

This example shows how to capture an image by rendering it to a texture, copying the texture to
a buffer, and retrieving it from the buffer.

This could be used for "taking a screenshot," with the added benefit that this method doesn't
require a window to be created.

## To Run

```
cargo run --example capture
open examples/capture/red.png
```

## Screenshots

![Capture example](./screenshot.png)
Binary file added examples/capture/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions examples/cube/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# cube

This example renders a textured cube.

## To Run

```
cargo run --example cube
```

## Screenshots

![Cube example](./screenshot.png)
Binary file added examples/cube/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions examples/describe/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# describe

This example prints output describing the adapter in use.

## To Run

```
cargo run --example describe
```

## Example output

```
# You might see different output as it depends on your graphics card
AdapterInfo { name: "Intel(R) UHD Graphics 630", vendor: 0, device: 0, device_type: IntegratedGpu, backend: Metal }
```
22 changes: 22 additions & 0 deletions examples/hello-compute/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# hello-compute

Runs a compute shader to determine the number of iterations of the rules from
Collatz Conjecture

- If n is even, n = n/2
- If n is odd, n = 3n+1

that it will take to finish and reach the number `1`.

## To Run

```
# Pass in any 4 numbers as arguments
RUST_LOG=hello_compute cargo run --example hello-compute 1 4 3 295
```

## Example Output

```
[2020-04-25T11:15:33Z INFO hello_compute] Times: [0, 2, 7, 55]
```
13 changes: 13 additions & 0 deletions examples/hello-triangle/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# hello-triangle

This example renders a triangle to a window.

## To Run

```
cargo run --example hello-triangle
```

## Screenshots

![Triangle window](./screenshot.png)
Binary file added examples/hello-triangle/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions examples/mipmap/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# mipmap

This example shows how to generate and make use of mipmaps.

## To Run

```
cargo run --example mipmap
```

## Screenshots

![Mip maps](./screenshot.png)
Binary file added examples/mipmap/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions examples/msaa-line/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# msaa-line

This example shows how to render lines using MSAA.

## To Run

```
cargo run --example msaa-line
```

## Screenshots

![MSAA line](./screenshot.png)
Binary file added examples/msaa-line/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions examples/shadow/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# shadow

This animated example demonstrates shadow mapping.

## To Run

```
cargo run --example shadow
```

## Screenshots

![Shadow mapping](./screenshot.png)
Binary file added examples/shadow/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions examples/skybox/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# skybox

This animated example demonstrates rendering a skybox.

## To Run

```
cargo run --example skybox
```

## Screenshots

![Skybox](./screenshot.png)

![Skybox 2](./screenshot2.png)
Binary file added examples/skybox/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/skybox/screenshot2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 309cc1c

Please sign in to comment.