summaryrefslogtreecommitdiff
path: root/mino.c
diff options
context:
space:
mode:
Diffstat (limited to 'mino.c')
-rw-r--r--mino.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/mino.c b/mino.c
index 2da1700..3362ab3 100644
--- a/mino.c
+++ b/mino.c
@@ -8,9 +8,40 @@ V*make(Uz z){V*p;N(p=malloc(z), die("oom"))R p;}
V*remk(V*p,Uz z){N(p=realloc(p,z),die("oom"))R p;}
V del(V*p){free(p);}
-I main(I ac,C**av){(V)ac,(V)av;U32 cat;
+_ IM C shader_tex_vert[]=GRAPH_GLSL(
+ layout (location=0) in vec3 pos;
+ layout (location=1) in vec3 col;
+ layout (location=2) in vec2 tex;
+ out vec3 Col;
+ out vec2 Tex;
+ void main(){gl_Position=vec4(pos,1.0);Col=col;Tex=tex;});
+
+_ IM C shader_tex_frag[]=GRAPH_GLSL(
+ out vec4 Frag;
+ in vec3 Col;
+ in vec2 Tex;
+ uniform sampler2D buf0;
+ uniform sampler2D buf1;
+ void main(){Frag=texture(buf0,Tex)*texture(buf1,Tex);});
+_ U32 shader_tex;
+
+_ V shader_tex_init(V){
+ shader_tex=graph_shader_create(shader_tex_vert,shader_tex_frag),
+ graph_shader_use(shader_tex),
+ graph_shader_seti("buf0",0),
+ graph_shader_seti("buf1",1);}
+
+I main(I ac,C**av){(V)ac,(V)av;U32 cat,fart;
graph_init();
atexit(graph_deinit);
+
+ shader_tex_init();
cat=graph_tex_create("res/tex/cat.jpg");
- WH(1,graph_before(),graph_events(),graph_quad(cat),graph_after());
+ fart=graph_tex_create("res/tex/fart.jpg");
+ WH(1,graph_before(),graph_events(),
+ graph_shader_use(shader_tex),
+ graph_tex_use(cat,0),
+ graph_tex_use(fart,1),
+ graph_quad(),
+ graph_after());
R 0;}