From 5906c694519d0a5cca339c71f9b6a1fdc6dd1de8 Mon Sep 17 00:00:00 2001 From: bx Date: Tue, 5 Apr 2022 15:49:46 +0100 Subject: [PATCH] copied over shadertoy uniform comments --- sdfps.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/sdfps.c b/sdfps.c index a8a8a0d..e94ddd7 100644 --- a/sdfps.c +++ b/sdfps.c @@ -36,7 +36,7 @@ void init(Sdfps* s) { /* TODO: Error checks */ s -> window = SDL_CreateWindow("sdfps", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, - 800, 600, + 512 + 128, 512 + 128, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE); s -> context = SDL_GL_CreateContext(s -> window); @@ -57,6 +57,17 @@ void init(Sdfps* s) { /* TODO: Error checks */ "#version 330\n" "precision highp float;\n" + /* ~ from shader toy ~ + uniform float iTimeDelta; // render time (in seconds) + uniform int iFrame; // shader playback frame + uniform float iChannelTime[4]; // channel playback time (in seconds) + uniform vec3 iChannelResolution[4]; // channel resolution (in pixels) + uniform vec4 iMouse; // mouse pixel coords. xy: current (if MLB down), zw: click + uniform samplerXX iChannel0..3; // input channel. XX = 2D/Cube + uniform vec4 iDate; // (year, month, day, time in seconds) + uniform float iSampleRate; // sound sample rate (i.e., 44100) + */ + /* viewport resolution (in pixels), z = 1 */ "uniform vec3 iResolution;\n" /* playback time in seconds */ @@ -167,7 +178,8 @@ void render(Sdfps *s) { get data back out of a shader, there's probs a more proper way to do it that we could change to later UPDATE: looking at shader toy's source it seems it uses this function to - get output for sound shaders + get output for sound shaders, so i'm going to guess that it'd be fine of + us to render gur sdf feedback into a lower segment of gur frame buffer */ f32 pixels[16 * 16 * 4] = { 0.0f }; glReadPixels(