openwallpaper
Loading...
Searching...
No Matches
Examples

Repository contains some small scenes that demonstrate OpenWallpaper API usage.

Building examples

To build examples yourself, you will need to install:

  • WASM C compiler, wasi-sdk recommended
  • glslc

Clone the repository:

git clone --depth=1 --recurse-submodules https://github.com/mechakotik/openwallpaper
cd openwallpaper

Build examples, specifying the path to WASM C compiler in WASM_CC environment variable:

WASM_CC=/opt/wasi-sdk/bin/clang ./examples/build.sh

Each script writes scene.wasm and generated assets to a scene directory in the corresponding example directory. Run an example with:

wallpaperd examples/triangle/scene/scene.wasm

triangle

Draws a triangle in the center of the screen, classic example of graphics API usage. You can see an explanation of how this code works in Drawing a triangle developer guide section.

Source code

fullscreen-shader

Demonstrates how to run shader wallpapers (e.g. from ShaderToy) in OpenWallpaper. Shader that was ported is Singularity by @XorDev.

Source code

image

Draws a static image, simplest example of texture rendering. Original image is Scarlett Tree from KDE Plasma 6 artwork.

Source code

rain

Draws particles to create a rain-like effect. An example of using instanced rendering to draw a lot of similar objects efficiently.

Source code

visualizer

Example of using ow_get_audio_spectrum to visualize audio. It gets spectrum data and draws it as white bars on the screen, without any preprocessing.

Source code