Skip to content

Commit 0393295

Browse files
committed
Fill in Processing 5.0 getting started page
1 parent ce30547 commit 0393295

1 file changed

Lines changed: 113 additions & 5 deletions

File tree

‎src/content/docs/getting-started/processing-5.md‎

Lines changed: 113 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,131 @@
22
title: Processing 5.0 (Java)
33
description: Build processing4 with the WebGPU renderer.
44
order: 5
5+
status: draft
56
languages: [java]
67
---
78

9+
Processing 5.0 is the next version of Processing, and it uses libprocessing for rendering. The WebGPU renderer is still experimental, so for now you have to build Processing yourself to try it.
10+
11+
:::note
12+
This is a beta. Things may break. If you get stuck, tell us what happened in an issue so we can improve these steps.
13+
:::
14+
15+
If you only want to use the stable version of Processing, you don't need any of this. Download it from [processing.org](https://processing.org/download).
16+
817
## Requirements
918

10-
:::todo
11-
JDK 25, Rust and jextract.
19+
You need these installed before you build:
20+
21+
- **JDK 25.** Processing uses the Temurin build of OpenJDK. On macOS, install it with `brew install --cask temurin@25`. On other systems, download Temurin 25 from [adoptium.net](https://adoptium.net).
22+
- **Rust.** Install it with [rustup](https://rustup.rs). The build compiles libprocessing, which is written in Rust, for you.
23+
- **jextract.** This tool turns C header files into Java bindings. The processing4 build can fetch it for you. If the build stops with a jextract error, download it from [jdk.java.net/jextract](https://jdk.java.net/jextract/), or install it with [SDKMAN!](https://sdkman.io/) using `sdk install jextract`.
24+
- **Git**, to clone the repository.
25+
26+
:::caution[Windows only]
27+
Rust on Windows needs Microsoft's C++ linker. Without it, the build fails with `linker link.exe not found`. Install **Build Tools for Visual Studio** and tick **Desktop development with C++**. Visual Studio Code is a different product and is not enough.
1228
:::
1329

30+
Check that the tools are available:
31+
32+
```bash
33+
java -version
34+
rustc --version
35+
git --version
36+
```
37+
38+
`java -version` should print version 25.
39+
1440
## Build
1541

16-
:::todo
17-
processing4 `main` branch, `./gradlew build -PenableWebGPU=true`.
42+
Clone processing4 with its submodules. libprocessing comes in as a submodule, so the `--recursive` flag matters:
43+
44+
```bash
45+
git clone --recursive https://github.com/processing/processing4.git
46+
cd processing4
47+
```
48+
49+
Build it with the WebGPU flag turned on:
50+
51+
```bash
52+
./gradlew build -PenableWebGPU=true
53+
```
54+
55+
On Windows, use `gradlew.bat` instead of `./gradlew`.
56+
57+
:::note
58+
The first build is slow. Gradle downloads itself, and then the Rust part downloads and compiles several hundred packages. Keep the terminal open and give it time. Later builds are much faster.
1859
:::
1960

61+
You will probably see a warning that Kotlin does not support JDK 25 yet and falls back to JVM 24. This is expected and does not stop the build.
62+
2063
## Run the WebGPU examples
2164

65+
Start the Processing editor (the PDE) with the WebGPU renderer turned on:
66+
67+
```bash
68+
./gradlew run -PenableWebGPU=true
69+
```
70+
71+
On Windows, use `gradlew.bat run -PenableWebGPU=true`.
72+
73+
When the editor opens, paste this sketch in and press Run:
74+
75+
```java
76+
void setup() {
77+
size(400, 400, WEBGPU);
78+
}
79+
80+
void draw() {
81+
background(51);
82+
fill(255);
83+
noStroke();
84+
rect(10, 10, 100, 100);
85+
}
86+
```
87+
88+
You should see a white square on a dark grey background. The `WEBGPU` in `size()` is what switches the sketch to the new renderer.
89+
2290
:::todo
23-
Where `core/examples/.../webgpu/` lives.
91+
These run steps come from processing4 PR #1582 and have not been tested on Windows yet. If you get the build to finish, please confirm that the editor opens and the sketch runs, and update this page.
92+
:::
93+
94+
:::note
95+
WebGPU is experimental. If the window stays empty or the sketch fails to start, please open an issue and tell us your operating system and graphics card.
2496
:::
97+
98+
## Troubleshooting
99+
100+
### Gradle fails to download itself
101+
102+
```txt
103+
Downloading https://services.gradle.org/distributions/gradle-9.1.0-bin.zip
104+
Exception in thread "main" java.io.IOException: ... failed: timeout (10000ms)
105+
```
106+
107+
The first `gradlew` run downloads Gradle, and on a slow connection it can time out after 10 seconds. Run the command again first. If it keeps failing, open `gradle/wrapper/gradle-wrapper.properties` and raise `networkTimeout=10000` to `networkTimeout=120000`. Don't commit that change if you plan to send a pull request.
108+
109+
### linker `link.exe` not found (Windows)
110+
111+
```txt
112+
error: linker `link.exe` not found
113+
note: the msvc targets depend on the msvc linker but `link.exe` was not found
114+
```
115+
116+
The Rust build needs the Microsoft C++ linker. Open **Visual Studio Installer**, choose **Modify** on Build Tools 2022, tick **Desktop development with C++**, and install. Then close your terminal, open a new one, and run the build again. The Rust packages that were already downloaded are cached, so the second run skips most of the downloading.
117+
118+
### Permission denied or Could not copy file
119+
120+
Clean the project and build again:
121+
122+
```bash
123+
./gradlew clean
124+
```
125+
126+
### The libprocessing folder is missing
127+
128+
You probably cloned without `--recursive`. Fetch the submodule and build again:
129+
130+
```bash
131+
git submodule update --init --recursive
132+
```

0 commit comments

Comments
 (0)