diff --git a/.claude/skills/add-page/SKILL.md b/.claude/skills/add-page/SKILL.md index 90b2145..3125313 100644 --- a/.claude/skills/add-page/SKILL.md +++ b/.claude/skills/add-page/SKILL.md @@ -38,7 +38,7 @@ Body: - No `# H1`; the title comes from frontmatter. Start at `##`. - An outline is `##` headings in the order a reader needs them, with a `:::todo` note under any heading whose content isn't obvious. -- Internal links are absolute with a trailing slash: `/getting-started/mewnala/`. +- Internal links are absolute with a trailing slash: `/getting-started/processing-py/`. - Text copied from somewhere else keeps its wording, gets a `:::note` at the top linking to the source ("copied from … for now; if they disagree, the source wins"), and bare issue numbers like `#188` become links to `https://github.com/processing/libprocessing/issues/188`. ## 3. Set `order` and renumber diff --git a/.claude/skills/ui-change/SKILL.md b/.claude/skills/ui-change/SKILL.md index 8421b98..a4f94dc 100644 --- a/.claude/skills/ui-change/SKILL.md +++ b/.claude/skills/ui-change/SKILL.md @@ -41,7 +41,7 @@ Every UI change needs a passing build and screenshots before it's done. npx astro preview --port 4329 ``` - Then, for each page the change affects (always include `/` and one docs page, e.g. `/getting-started/mewnala/`): + Then, for each page the change affects (always include `/` and one docs page, e.g. `/getting-started/processing-py/`): ```sh CHROME="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" diff --git a/src/components/SiteFooter.astro b/src/components/SiteFooter.astro index f339cc3..a28b194 100644 --- a/src/components/SiteFooter.astro +++ b/src/components/SiteFooter.astro @@ -6,7 +6,7 @@ import Divider from './Divider.astro'; const links = [ { label: 'libprocessing on GitHub', href: site.links.github }, { label: 'processing4 on GitHub', href: site.links.processing4 }, - { label: 'Python API (mewnala)', href: site.links.pythonApi }, + { label: 'Python API (processing-py)', href: site.links.pythonApi }, { label: 'Rust API', href: site.links.rustApi }, { label: 'Discord', href: site.links.discord }, ].filter(({ href }) => href); diff --git a/src/content/docs/architecture/api-objects.md b/src/content/docs/architecture/api-objects.md deleted file mode 100644 index bc73874..0000000 --- a/src/content/docs/architecture/api-objects.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: Internal API objects -description: Surface, Graphics, Light and the other objects the API is built on. -order: 2 ---- - -## Surface - -## Graphics - -## Light diff --git a/src/content/docs/architecture/embedding.md b/src/content/docs/architecture/embedding.md deleted file mode 100644 index 0741b3e..0000000 --- a/src/content/docs/architecture/embedding.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: Embedding mewnala -description: The host API for running several sketches inside one app. -order: 6 -languages: [python] ---- - -## The host API - -## Running multiple sketches diff --git a/src/content/docs/architecture/immediate-vs-retained.md b/src/content/docs/architecture/immediate-vs-retained.md deleted file mode 100644 index 132ce03..0000000 --- a/src/content/docs/architecture/immediate-vs-retained.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: Immediate vs. retained mode -description: How Processing's immediate-mode API maps onto Bevy's retained-mode renderer. -order: 4 ---- - -## Recording - -## Flushing - -## The camera model diff --git a/src/content/docs/architecture/index.md b/src/content/docs/architecture/index.md index 7f6a8cb..fd6e1b1 100644 --- a/src/content/docs/architecture/index.md +++ b/src/content/docs/architecture/index.md @@ -5,3 +5,10 @@ description: How libprocessing is built, and why. order: 5 status: outline --- + +:::todo +- [ ] Add an architecture diagram here +- [ ] Link to principles, or add them there +::: + + diff --git a/src/content/docs/architecture/principles.md b/src/content/docs/architecture/principles.md deleted file mode 100644 index e4476a2..0000000 --- a/src/content/docs/architecture/principles.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: Principles -description: The design principles behind the project. -order: 1 ---- - -:::todo -Keep the canonical copy here or on the mkdocs site, not both. -::: diff --git a/src/content/docs/architecture/processing-5.md b/src/content/docs/architecture/processing-5.md deleted file mode 100644 index 321c36b..0000000 --- a/src/content/docs/architecture/processing-5.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: How Processing 5.0 uses libprocessing -navLabel: Processing 5.0 integration -description: The submodule, the generated Java bindings and the renderer classes. -order: 5 -languages: [java] ---- - -## The git submodule - -## From cbindgen header to Java bindings - -:::todo -jextract. -::: - -## PGraphicsWebGPU and PSurfaceGLFW - -## The PShader interface split - -## Updating the submodule pin diff --git a/src/content/docs/architecture/tech-stack.md b/src/content/docs/architecture/tech-stack.md deleted file mode 100644 index f9f8d83..0000000 --- a/src/content/docs/architecture/tech-stack.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: Technology stack -description: From the language bindings down to the GPU. -order: 3 ---- - -:::todo -A diagram: cbindgen → FFI → libprocessing → Bevy → wgpu → Vulkan/Metal. -::: diff --git a/src/content/docs/architecture/testing.md b/src/content/docs/architecture/testing.md deleted file mode 100644 index 7bff161..0000000 --- a/src/content/docs/architecture/testing.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: Testing -description: Visual regression tests in CI. -order: 7 ---- - -## Rendering reference images - -:::todo -`just visual-render` -::: - -## Comparing - -:::todo -`just visual-compare` -::: diff --git a/src/content/docs/community/index.md b/src/content/docs/community/index.md index deda7f9..67940b9 100644 --- a/src/content/docs/community/index.md +++ b/src/content/docs/community/index.md @@ -11,8 +11,8 @@ links: href: https://github.com/processing/processing4 description: Processing 5.0 lives on the main branch. - label: Discord - href: "" - description: Come say hi in #devs-chat. + href: https://discord.gg/gQHTgNuC5c + description: "Come say hi in #devs-chat." - label: Processing Foundation href: https://processingfoundation.org --- diff --git a/src/content/docs/contributing/writing-docs.md b/src/content/docs/contributing/writing-docs.md index d19258e..93d69fc 100644 --- a/src/content/docs/contributing/writing-docs.md +++ b/src/content/docs/contributing/writing-docs.md @@ -20,7 +20,7 @@ src/content/docs/ ├── index.md → / ├── getting-started/ │ ├── index.md → /getting-started/ (section landing page) -│ └── mewnala.md → /getting-started/mewnala/ +│ └── processing-py.md → /getting-started/processing-py/ └── faq/ └── index.md → /faq/ ``` @@ -31,14 +31,14 @@ Each top-level folder is a section in the navigation, and its `index.md` is the ```yaml --- -title: mewnala (Python) # required +title: processing-py (Python) # required description: One sentence. # shown under the title, in cards, and in search results -navLabel: mewnala # shorter label for the sidebar (optional) +navLabel: processing-py # shorter label for the sidebar (optional) order: 1 # position in the sidebar, lowest first status: outline # outline | draft | ready languages: [python] # python | rust | java | web links: # optional cards shown above the page body - - label: mewnala API + - label: processing-py API href: https://processing.github.io/libprocessing/ description: Generated from docstrings. --- diff --git a/src/content/docs/faq/index.md b/src/content/docs/faq/index.md index 53ecb9d..eaa29af 100644 --- a/src/content/docs/faq/index.md +++ b/src/content/docs/faq/index.md @@ -79,6 +79,6 @@ In Processing 5.0, libprocessing is an optional WebGPU renderer alongside the ex - [libprocessing design principles](https://github.com/processing/libprocessing/blob/main/docs/principles.md), written at the start of the project - [Bevy's sixth birthday](https://bevy.org/news/bevys-sixth-birthday/), on the size and activity of the Bevy community - [Bevy 0.19: render big scenes faster](https://bevy.org/news/bevy-0-19/#render-big-scenes-faster), on recent GPU-driven performance improvements -- [Python examples](https://github.com/processing/libprocessing/tree/main/crates/processing_pyo3/examples) and [processing-examples-mewnala](https://github.com/processing/processing-examples-mewnala/) +- [Python examples](https://github.com/processing/libprocessing/tree/main/crates/processing_pyo3/examples) - Talks on the project's strategy and vision, listed on the [Community](/community/) page - #devs-chat on Discord diff --git a/src/content/docs/getting-started/index.md b/src/content/docs/getting-started/index.md index 7041b1d..c555af1 100644 --- a/src/content/docs/getting-started/index.md +++ b/src/content/docs/getting-started/index.md @@ -5,6 +5,23 @@ order: 1 status: outline --- -:::todo -One short paragraph to help someone choose a language. Each guide below should end with a sketch running on screen. +:::note +Hi! Wow. Welcome to our "Getting Started" page. I hope it's really good. But it more likely just needs a ton of improvements. +You are very welcome to help with that. Because Moon is about doing her best to deliver 80%. ::: + +## What is "libprocessing"? +libprocessing is a shared core written in [Rust](https://rust-lang.org). The purpose of this project +is to overhaul the rendering capabilities in the eponymous Java project called [Processing](https://processing.org). +The new 5.0 version of that project will be making heavy use of this particular project. + +The other purpose of writing a project like this in Rust (and not Java) is so that we are able to support other projects, too. +We already have demonstrated an ability to write python sketches with [processing-py](processing-py/), and to build sketches that run in the web with [WASM (web assembly)](web/). + +This is a really exciting project for us, and we're super excited that you're interested in learning more. + +## Next steps + +- If you are wanting to work with the shared core in rust, take a look at [libprocessing](rust/) itself. +- If you are wanting to see what is happening in Processing 5.0, go [here](processing-5/)! +- If you are wanting to try writing a Processing sketch in python, go install [processing-py](processing-py/) and give it a try! diff --git a/src/content/docs/getting-started/jupyter.md b/src/content/docs/getting-started/jupyter.md deleted file mode 100644 index 532e11a..0000000 --- a/src/content/docs/getting-started/jupyter.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: Jupyter & IPython -description: Run sketches from a notebook or the REPL. -order: 2 -languages: [python] ---- - -## Jupyter - -:::todo -`just py-jupyter` -::: - -## IPython - -:::todo -`just py-ipython` -::: diff --git a/src/content/docs/getting-started/mewnala.md b/src/content/docs/getting-started/mewnala.md deleted file mode 100644 index 550890f..0000000 --- a/src/content/docs/getting-started/mewnala.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: mewnala (Python) -description: Install mewnala with uv and run a sketch. -order: 1 -languages: [python] ---- - -## Install uv - -## Create a sketchbook - -## Write a sketch - -## Run it - -:::todo -Point out the snake_case naming (`mouseX` becomes `mouse_x`). -::: - -## Next steps diff --git a/src/content/docs/getting-started/processing-5.md b/src/content/docs/getting-started/processing-5.md index 17aa0d7..990de25 100644 --- a/src/content/docs/getting-started/processing-5.md +++ b/src/content/docs/getting-started/processing-5.md @@ -2,23 +2,131 @@ title: Processing 5.0 (Java) description: Build processing4 with the WebGPU renderer. order: 5 +status: draft languages: [java] --- +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. + +:::note +This is a beta. Things may break. If you get stuck, tell us what happened in an issue so we can improve these steps. +::: + +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). + ## Requirements -:::todo -JDK 25, Rust and jextract. +You need these installed before you build: + +- **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). +- **Rust.** Install it with [rustup](https://rustup.rs). The build compiles libprocessing, which is written in Rust, for you. +- **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`. +- **Git**, to clone the repository. + +:::caution[Windows only] +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. ::: +Check that the tools are available: + +```bash +java -version +rustc --version +git --version +``` + +`java -version` should print version 25. + ## Build -:::todo -processing4 `main` branch, `./gradlew build -PenableWebGPU=true`. +Clone processing4 with its submodules. libprocessing comes in as a submodule, so the `--recursive` flag matters: + +```bash +git clone --recursive https://github.com/processing/processing4.git +cd processing4 +``` + +Build it with the WebGPU flag turned on: + +```bash +./gradlew build -PenableWebGPU=true +``` + +On Windows, use `gradlew.bat` instead of `./gradlew`. + +:::note +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. ::: +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. + ## Run the WebGPU examples +Start the Processing editor (the PDE) with the WebGPU renderer turned on: + +```bash +./gradlew run -PenableWebGPU=true +``` + +On Windows, use `gradlew.bat run -PenableWebGPU=true`. + +When the editor opens, paste this sketch in and press Run: + +```java +void setup() { + size(400, 400, WEBGPU); +} + +void draw() { + background(51); + fill(255); + noStroke(); + rect(10, 10, 100, 100); +} +``` + +You should see a white square on a dark grey background. The `WEBGPU` in `size()` is what switches the sketch to the new renderer. + :::todo -Where `core/examples/.../webgpu/` lives. +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. +::: + +:::note +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. ::: + +## Troubleshooting + +### Gradle fails to download itself + +```txt +Downloading https://services.gradle.org/distributions/gradle-9.1.0-bin.zip +Exception in thread "main" java.io.IOException: ... failed: timeout (10000ms) +``` + +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. + +### linker `link.exe` not found (Windows) + +```txt +error: linker `link.exe` not found +note: the msvc targets depend on the msvc linker but `link.exe` was not found +``` + +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. + +### Permission denied or Could not copy file + +Clean the project and build again: + +```bash +./gradlew clean +``` + +### The libprocessing folder is missing + +You probably cloned without `--recursive`. Fetch the submodule and build again: + +```bash +git submodule update --init --recursive +``` \ No newline at end of file diff --git a/src/content/docs/getting-started/processing-py.md b/src/content/docs/getting-started/processing-py.md new file mode 100644 index 0000000..5b559f3 --- /dev/null +++ b/src/content/docs/getting-started/processing-py.md @@ -0,0 +1,78 @@ +--- +title: processing-py (Python) +description: Install processing-py with uv and run a sketch. +order: 2 +languages: [python] +--- + +Inside of our `processing_pyo3` crate we have created a python package which we have published to PyPi. +Again, we are still very nascent, but let us know what kinds of snags you may run into while getting this set up. +Try running the examples in the [processing_pyo3 examples directory](crates/processing_pyo3/examples). + + +## To Get Started + +### Installing `uv` + +We are big fans of [uv](https://github.com/astral-sh/uv) and this is our recomended way to get started using `processing-py` + +#### Setting up uv on linux or macOS +```bash +curl -LsSf https://astral.sh/uv/install.sh | sh +``` + +#### For Windows users: +```bash +powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" +``` + +## Add processing-py + +We're going to create a folder named `processing-py-sketchbook` and install the `processing-py` package inside: + +```bash +# Initialize a project with uv +uv init processing-py-sketchbook + +# Enter the project directory +cd processing-py-sketchbook + +# add the package +uv add processing-py +``` + +Now create a file named `sketch.py` at the root of `processing-py-sketchbook`. + +:::note +you can use any file name you want for your sketch +::: + +You can use this code to test + +```python +from processing_py import * + +def setup(): + size(400, 400) + background(255) + +def draw(): + push_matrix() + translate(mouse_x, mouse_y) + fill(255, 100, 200) + circle(0, 0, 50) + pop_matrix() + +run() +``` + +Now run your sketch using: + +```bash +# run a sketch +uv run sketch.py +``` +### More Examples + +Checkout the [Examples Page](/examples/) to help you get started. + diff --git a/src/content/docs/getting-started/release-vs-main.md b/src/content/docs/getting-started/release-vs-main.md deleted file mode 100644 index 03028e8..0000000 --- a/src/content/docs/getting-started/release-vs-main.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: PyPI release vs. main -navLabel: Release vs. main -description: What the published package contains compared with building from source. -order: 3 -languages: [python] ---- - -## The PyPI release - -:::todo -Currently 0.0.8. Say what it does and does not include. -::: - -## Building from main - -:::todo -`just py-build` -::: diff --git a/src/content/docs/getting-started/rust.md b/src/content/docs/getting-started/rust.md index 416e12c..88cd6fb 100644 --- a/src/content/docs/getting-started/rust.md +++ b/src/content/docs/getting-started/rust.md @@ -1,7 +1,7 @@ --- title: libprocessing (Rust) description: Build libprocessing from source and run the Rust examples. -order: 4 +order: 1 languages: [rust] --- @@ -25,17 +25,20 @@ git submodule update --init ### Build commands -This project uses [just](https://github.com/casey/just) as a command runner: +## Run an example ```bash -cargo install just +cargo run --example # to list out all the available examples +cargo run --example # to run an example in examples/ directory ``` -Run `just` to see available commands. - -## Run an example +## `just` command runner +This project uses [just](https://github.com/casey/just) to automate tasks around visual testing, python, WASM, and documentation: +### To Install ```bash -cargo run --example # to list out all the available examples -cargo run --example # to run an example in examples/ directory +cargo install just ``` + +Run `just` to see available commands. + diff --git a/src/content/docs/index.md b/src/content/docs/index.md index 61c52a2..08c47b6 100644 --- a/src/content/docs/index.md +++ b/src/content/docs/index.md @@ -17,9 +17,9 @@ quickstarts: command: git clone --recursive https://github.com/processing/libprocessing href: /getting-started/rust/ - language: python - title: mewnala - command: uv add mewnala - href: /getting-started/mewnala/ + title: processing-py + command: uv add processing-py + href: /getting-started/processing-py/ - language: java title: Processing 5.0 command: ./gradlew build -PenableWebGPU=true @@ -34,8 +34,9 @@ quickstarts: libprocessing is research and development. Nothing here is stable, and APIs change without notice. ::: -`libprocessing` is a shared core written in Rust meant to serve as a new rendering engine in Processing 5.0. -We are building this in a very lightweight and modular way as to enable the potential to support other projects. -This already is being used for an experimental Python library (mewnala), and we are able to run examples built with libprocessing in the web browser using WASM. +`libprocessing` is a shared core written in Rust. It was first started to serve as a new rendering engine in Processing 5.0, +We are building this in a very lightweight and modular way as to support other projects. +This already is being used for an experimental Python library (processing-py), and we are able to run examples built with libprocessing in the web browser using WASM. -But more than being able to make sketching environments, we would like for `libprocessing` to enable other types of tools and integrations with a plurality of creative workflows. +But more than being able to make sketching environments, we would like for `libprocessing` +to support new tools, creative workflows, and enable more interoperability in the open source ecosystem. diff --git a/src/content/docs/reference/index.md b/src/content/docs/reference/index.md index 4213f39..4e2f47c 100644 --- a/src/content/docs/reference/index.md +++ b/src/content/docs/reference/index.md @@ -4,18 +4,12 @@ description: Links to the generated reference for each language. This site doesn order: 4 status: outline links: - - label: mewnala (Python) - href: https://processing.github.io/libprocessing/ - description: mkdocs site, generated from docstrings. - label: libprocessing (Rust) href: "" description: rustdoc for every crate. - - label: Java (processing.webgpu) - href: https://github.com/processing/processing4 - description: processing4 source and the Processing reference. - - label: Web (wasm) - href: "" - description: JavaScript API. + - label: processing-py (Python) + href: https://processing.github.io/libprocessing/ + description: mkdocs site, generated from docstrings. --- ## Rust crates @@ -26,20 +20,14 @@ One line per crate on what it's for. | Crate | What it's for | | --- | --- | -| `processing_core` | | -| `processing_render` | | -| `processing_ffi` | | -| `processing_pyo3` | | -| `processing_audio` | | -| `processing_cuda` | | -| `processing_glfw` | | -| `processing_input` | | -| `processing_midi` | | -| `processing_webcam` | | -| `processing_wasm` | | - -## C FFI - -:::todo -`processing_ffi` in rustdoc, plus where the cbindgen header lives. -::: +| `processing_core` | Core of libprocessing | +| `processing_render` | Rendering functionality | +| `processing_ffi` | We expose the FFI layer here | +| `processing_pyo3` | This is where `processing-py` is defined | +| `processing_audio` | Crate for managing audio I/O | +| `processing_cuda` | API calls for working with Nvidia's CUDA | +| `processing_glfw` | Shim for working with glfw | +| `processing_input` | Input crate | +| `processing_midi` | Crate for managing midi I/O | +| `processing_webcam` | Webcam related APIs | +| `processing_wasm` | WASM related | diff --git a/src/content/docs/roadmap/index.md b/src/content/docs/roadmap/index.md index 075bea3..8f3c28c 100644 --- a/src/content/docs/roadmap/index.md +++ b/src/content/docs/roadmap/index.md @@ -24,7 +24,7 @@ Platform targets (desktop, web/WASM, embedded, XR) cut across all of these. - Stable release on upstream bevy, published to crates.io - CI with example, visual, and performance regression testing - Documentation site with architecture, contributing guide, API reference, and tutorials -- Language bindings beyond Rust (Python via mewnala, Java for Processing, JS for p5.js) +- Language bindings beyond Rust (Python via processing-py, Java for Processing, JS for p5.js) - Live coding and hot reload of sketches and shaders ## 1. Core Rendering Technologies