summaryrefslogtreecommitdiff
path: root/graph.c
diff options
context:
space:
mode:
authorkitty piapiac <kcp@bsd.computer>2023-04-17 23:46:30 -0700
committerkitty piapiac <kcp@bsd.computer>2023-04-17 23:46:30 -0700
commit5393ce93d05f9979b7882c686b241f6738011c64 (patch)
treeb68d664d2c5c47490c0dbba8ef72a4974e516210 /graph.c
parentf92b613698b5c4066068bb937b5993b1c5a3bd24 (diff)
mat4 transformations
Diffstat (limited to 'graph.c')
-rw-r--r--graph.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/graph.c b/graph.c
index 92316c3..4e025c9 100644
--- a/graph.c
+++ b/graph.c
@@ -2,6 +2,7 @@
#include<glad/glad.h>
#define SDL_MAIN_HANDLED
#include<SDL.h>
+#include<cglm/cglm.h>
#include"mino.h"
#include"graph.h"
#include"tex.h"
@@ -46,6 +47,8 @@ V graph_deinit(V){SDL_GL_DeleteContext(ctx),SDL_DestroyWindow(win),SDL_Quit();}
V graph_before(V){glClearColor(1.0,0.75,0.8,1.0),glClear(GL_COLOR_BUFFER_BIT);}
V graph_after(V){SDL_GL_SwapWindow(win);}
+U32 graph_ticks(V){R SDL_GetTicks();}
+
_ U32 q_vao,q_vbo,q_ebo;
_ V q_init(V){
_ IM F32 verts[]={
@@ -84,8 +87,8 @@ U32 graph_shader_create(IM C*vert,IM C*frag){I ok;C info[512];U32 v,f,p;
R p;}
V graph_shader_use(U32 s){glUseProgram(s);}
-V graph_shader_seti(IM C*s,I i){I p;glGetIntegerv(GL_CURRENT_PROGRAM,&p),
- glUniform1i(glGetUniformLocation(p,s),i);}
+V graph_shader_setI(IM C*s,I i) {I p;glGetIntegerv(GL_CURRENT_PROGRAM,&p),glUniform1i(glGetUniformLocation(p,s),i);}
+V graph_shader_setM4(IM C*s,mat4 m4){I p;glGetIntegerv(GL_CURRENT_PROGRAM,&p),glUniformMatrix4fv(glGetUniformLocation(p,s),1,GL_FALSE,m4[0]);}
U32 graph_tex_create(IM C*f){Tex tex;U32 t;
glGenTextures(1,&t);