X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fscr%2Ftesta.c;h=5bf2e62901149b28237c25762bcc9277c260127b;hb=24570f00867a5df166103927da87f6f619cdec8a;hp=876ea519b68f591f350ab927643c002e005571fc;hpb=ef6f5c2822eb91ea7df55e88018f566be04ad287;p=andemo diff --git a/src/scr/testa.c b/src/scr/testa.c index 876ea51..5bf2e62 100644 --- a/src/scr/testa.c +++ b/src/scr/testa.c @@ -1,6 +1,48 @@ -#include "demosys.h" -#include "opengl.h" +#include "demo.h" +#include "noise.h" +#include "cgmath/cgmath.h" + +static int init(void); +static void destroy(void); +static void draw(void); + +static unsigned int sdr_foo; + +static struct demoscreen scr = { "testa", init, destroy, 0, 0, 0, 0, draw }; void regscr_testa(void) { + dsys_add_screen(&scr); +} + +static int init(void) +{ + if(!(sdr_foo = get_sdrprog("sdr/foo.v.glsl", "sdr/foo-notex.p.glsl"))) { + return -1; + } + return 0; +} + +static void destroy(void) +{ +} + +static void draw(void) +{ + int i; + float t = dsys.tmsec / 1000.0f; + float gap = cgm_lerp(0, 0.01, scr.vis); + + glUseProgram(sdr_foo); + gl_begin(GL_QUADS); + for(i=0; i<16; i++) { + float x0 = i / 8.0f - 1.0f + gap; + float x1 = (i + 1) / 8.0f - 1.0f - gap; + float y = cgm_lerp(1.0f, noise2((float)i * 1.24f, t), scr.vis); + gl_vertex2f(x0, -1); + gl_vertex2f(x1, -1); + gl_vertex2f(x1, y); + gl_vertex2f(x0, y); + } + gl_end(); }