Where did ShaderToy go?

While the ShaderToy version from the virserg repo currently seems to be the best working version of ShaderToy for my RPi2 with Kodi Leia v18.8 it is also possible to use the offical version from xbmc repo with some additional modifications:

  • build needs to be forced to use OpenGLES(2) instead of just OpenGL
  • ShaderToys main.cpp needs GL_RED defines replaced with GL_LUMINANCE

The first issue is caused by the cmake scripts to first look for GL and only after that looking for GLES presence. The addon doesn’t work with GL but needs GLES. I’m not sure if this is specific to RPi2 and if it would be possible to have GLES w/o GL on the system to avoid the detection issue.

The second issues was some change introduced mid last year in the xbmc repo. The difference between GL_RED and GL_LUMINANCE is only how the audio data gets transfered into a texture used by the ShaderToy shaders later. With GL_RED the data is placed only in the red color component while GL_LUMINANCE places it in all color elements. This shouldn’t be an issue as long as the shader will only access the red component later but somehow there is no audio data at all with GL_RED specified. So changing it back to GL_LUMINANCE will bring the audio data back.

I used the following procedure to build the ShaderToy addon from xbmc:

sudo apt-get install git, cmake, zip, gles2-mesa-dev
git clone --branch Leia https://github.com/xbmc/xbmc.git
git clone --branch Leia https://github.com/xbmc/visualization.shadertoy.git
cd visualization.shadertoy && git checkout 1.2.4-Leia && mkdir build && cd build
cmake -DADDONS_TO_BUILD=visualization.shadertoy -DADDON_SRC_PREFIX=../.. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../../xbmc/kodi-build/addons -DPACKAGE_ZIP=1 -DAPP_RENDER_SYSTEM=gles ../../xbmc/cmake/addons
make
cd ../../xbmc/kodi-build/addons && strip visualization.shadertoy/visualization.shadertoy.so.1.2.4
zip -r --symlinks visualization.shadertoy-1.2.4.zip visualization.shadertoy/

You can then install the addon from the resulting ZIP in ~/xbmc/kodi-build/addons

There are some of the shaders that don’t work (black screen) and I think there was one that crashed the addon (you will manually need to modify the settings file to change the current shader).