copied over shadertoy uniform comments

master
bx 2022-04-05 15:49:46 +01:00
parent c5ee25113f
commit 5906c69451
1 changed files with 14 additions and 2 deletions

16
sdfps.c
View File

@ -36,7 +36,7 @@ void init(Sdfps* s) { /* TODO: Error checks */
s -> window = SDL_CreateWindow("sdfps", s -> window = SDL_CreateWindow("sdfps",
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
800, 600, 512 + 128, 512 + 128,
SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE); SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
s -> context = SDL_GL_CreateContext(s -> window); s -> context = SDL_GL_CreateContext(s -> window);
@ -57,6 +57,17 @@ void init(Sdfps* s) { /* TODO: Error checks */
"#version 330\n" "#version 330\n"
"precision highp float;\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 */ /* viewport resolution (in pixels), z = 1 */
"uniform vec3 iResolution;\n" "uniform vec3 iResolution;\n"
/* playback time in seconds */ /* 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 get data back out of a shader, there's probs a more proper way to do it
that we could change to later that we could change to later
UPDATE: looking at shader toy's source it seems it uses this function to 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 }; f32 pixels[16 * 16 * 4] = { 0.0f };
glReadPixels( glReadPixels(