← Back

ofxShadertoy

github.com/tiagosr/ofxShadertoy · @tiagosr
OF 0.10 Graphics

Addon for openFrameworks that sets up and loads Shadertoy (http://www.shadertoy.com) shaders

88 19 Last commit 7y ago Created 11y ago

Forks

Forks pushed to more recently than tiagosr/ofxShadertoy itself, plus any admin-confirmed fork with commits of its own — worth checking if you're hitting issues with the original.

godofecht/ofxShadertoy by @godofecht · ★ 0 · pushed 1mo ago
interior-night/ofxShadertoy by @interior-night · ★ 0 · pushed 2mo ago
kasparsj/ofxShadertoy by @kasparsj · ★ 1 · pushed 11mo ago
fishkingsin/ofxShadertoy by @fishkingsin · ★ 0 · pushed 1y ago
brucelane/ofxShadertoy by @brucelane · ★ 0 · pushed 6y ago
aaronsherwood/ofxShadertoy by @aaronsherwood · ★ 0 · pushed 7y ago

README

ofxShadertoy



ofxaddons

openFrameworks addon for loading and displaying shaders from the Shadertoy page. Shadertoy is (c) iq This addon is distributed under the terms of the MIT License.

Usage



1. Set up your project to use the programmable shader. in the int main(...) function, set your window to use OpenGL 3.2 or greater: ``c++ ofGLWindowSettings settings; settings.setGLVersion(3, 2); // <--- ofxShadertoy NEEDS the GL Programmable Renderer settings.width = 1024; settings.height = 768; ofCreateWindow(settings); // <-------- setup the GL context

2. Set up the ofxShadertoy to load a file with the shadertoy glsl code
   
c++ ofxShadertoy shadertoy; ... shadertoy.load("shaders/raymarch.frag");

3. Set up textures if needed by the shader
   
c++ shadertoy.setTexture(0, nifty_texture);
`

4. In your draw() routine, draw a quad (or use begin() and end() to set up the shaders for a mesh) Effects happen in screen space.

Extensions



I've set up some extensions to the shader parameters, mostly relating to using a camera (for use, non-exclusively, with another one of my addons, ofxFPSControls). The new uniforms are:

uniform mat4 tCameraMatrix; - a camera matrix that can be set up using ofCamera` or any child class (e.g. ofxFPSControls)

Get this addon

HTTPS
SSH