summaryrefslogtreecommitdiff
path: root/mino.c
diff options
context:
space:
mode:
Diffstat (limited to 'mino.c')
-rw-r--r--mino.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/mino.c b/mino.c
index 3362ab3..f59a8f0 100644
--- a/mino.c
+++ b/mino.c
@@ -1,5 +1,7 @@
#include<stdio.h>
#include<stdlib.h>
+#include<cglm/affine.h>
+#include<cglm/cglm.h>
#include"mino.h"
#include"graph.h"
@@ -14,7 +16,8 @@ _ IM C shader_tex_vert[]=GRAPH_GLSL(
layout (location=2) in vec2 tex;
out vec3 Col;
out vec2 Tex;
- void main(){gl_Position=vec4(pos,1.0);Col=col;Tex=tex;});
+ uniform mat4 trans;
+ void main(){gl_Position=trans*vec4(pos,1.0);Col=col;Tex=tex;});
_ IM C shader_tex_frag[]=GRAPH_GLSL(
out vec4 Frag;
@@ -27,19 +30,23 @@ _ U32 shader_tex;
_ V shader_tex_init(V){
shader_tex=graph_shader_create(shader_tex_vert,shader_tex_frag),
+ graph_shader_use(shader_tex);
+ mat4 trans;
+ glm_mat4_identity(trans),
+ glm_translate(trans,(vec3){0.5,-0.5,0.5}),
+ glm_rotate(trans,0.2,(vec3){0,0,1}),
+ graph_shader_setM4("trans",trans),
graph_shader_use(shader_tex),
- graph_shader_seti("buf0",0),
- graph_shader_seti("buf1",1);}
+ 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),
+ WH(1,graph_before(),graph_events();
graph_tex_use(cat,0),
graph_tex_use(fart,1),
graph_quad(),