diff options
author | kitty piapiac <kcp@bsd.computer> | 2023-04-18 01:59:53 -0700 |
---|---|---|
committer | kitty piapiac <kcp@bsd.computer> | 2023-04-18 01:59:53 -0700 |
commit | 84bcb0274fc80d360ff0fbe5ede89643169f6165 (patch) | |
tree | a600a6a2211e8520f5275ea1704439a245cf28ce /mino.c | |
parent | 5393ce93d05f9979b7882c686b241f6738011c64 (diff) |
window projection
Diffstat (limited to 'mino.c')
-rw-r--r-- | mino.c | 28 |
1 files changed, 12 insertions, 16 deletions
@@ -16,39 +16,35 @@ _ IM C shader_tex_vert[]=GRAPH_GLSL( layout (location=2) in vec2 tex; out vec3 Col; out vec2 Tex; - uniform mat4 trans; - void main(){gl_Position=trans*vec4(pos,1.0);Col=col;Tex=tex;}); + uniform mat4 proj; + uniform mat4 model; + void main(){gl_Position=proj*model*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);}); + void main(){Frag=texture(buf0,Tex);}); + _ U32 shader_tex; +_ mat4 win_proj; _ 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_setM4("proj",win_proj), + graph_shader_setI("buf0",0);} -I main(I ac,C**av){(V)ac,(V)av;U32 cat,fart; +I main(I ac,C**av){(V)ac,(V)av;U32 cat; 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(); + glm_ortho(0,graph_win_w,0,graph_win_h,0,4,win_proj), + graph_shader_setM4("proj",win_proj), graph_tex_use(cat,0), - graph_tex_use(fart,1), - graph_quad(), + graph_quad_xywh(200,200,200,200), graph_after()); R 0;} |