X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fscr%2Ftesta.c;h=e5f1bb387e6db338b7d9a49a880426a1d4fdebf7;hb=313480bbe9994a200ed9a4355d97a033bf0d6151;hp=35e95d934a3aba5a68e8a0e0366404a51da6fd29;hpb=ba4adddb6685c5a64a3ca5cae56ba879841327ec;p=andemo diff --git a/src/scr/testa.c b/src/scr/testa.c index 35e95d9..e5f1bb3 100644 --- a/src/scr/testa.c +++ b/src/scr/testa.c @@ -1,3 +1,46 @@ -#include "demosys.h" -#include "opengl.h" +#include "demo.h" +#include "noise.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_time / 1000.0f; + + glUseProgram(sdr_foo); + gl_begin(GL_QUADS); + for(i=0; i<16; i++) { + float x0 = i / 8.0f - 1.0f + 0.01; + float x1 = (i + 1) / 8.0f - 1.0f - 0.01; + float y = noise2((float)i * 1.24f, t); + gl_vertex2f(x0, -1); + gl_vertex2f(x1, -1); + gl_vertex2f(x1, y); + gl_vertex2f(x0, y); + } + gl_end(); +}