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
  • zip

Clone the repository:

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

Set WASM_CC environment variable to your WASM C compiler path. If you have installed wasi-sdk to /opt/wasi-sdk, then the compiler is located in /opt/wasi-sdk/bin/clang.

export WASM_CC=/opt/wasi-sdk/bin/clang

Then you can build examples with shell scripts:

./examples/triangle/compile.sh
./examples/fullscreen-shader/compile.sh
./examples/image/compile.sh
./examples/rain/compile.sh
./examples/visualizer/compile.sh

Resulting .owf files will be in corresponding example directories.

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.

Download owf

Source code

fullscreen-shader

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

Download owf

Source code

image

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

Download owf

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.

Download owf

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.

Download owf

Source code