#include #include #include"mino.h" #include"graph.h" NR V die(IM C*f,...)VA(f,vfprintf(stderr,f,ap),fputc('\n',stderr),exit(1)) 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);} _ 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"); 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;}