diff options
| author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-05-26 17:34:58 +0200 | 
|---|---|---|
| committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-05-26 17:34:58 +0200 | 
| commit | 52bc19527838f2cac481a89cefd18cfea6e1a2d2 (patch) | |
| tree | aed452488b766f9e0f02d6e5237d6eecf0e8e909 /uniform.c | |
| parent | 33deac9462906c5e7b084665df3194cfa5e73249 (diff) | |
WIP add framebuffer
Diffstat (limited to 'uniform.c')
| -rw-r--r-- | uniform.c | 22 | 
1 files changed, 12 insertions, 10 deletions
@@ -6,19 +6,21 @@  int time_start = 0;  GLFWwindow* window = NULL; -GLint u_time, u_window; -void init_uniform(GLuint shader, GLFWwindow* _window) { +uniforms_t * init_uniforms(GLuint shader, GLFWwindow* _window) {  	window = _window; +	time_start = time(NULL); -	u_time = glGetUniformLocation(shader, "time"); -	u_window = glGetUniformLocation(shader, "window"); +	uniforms_t * uniforms = malloc(sizeof(uniforms_t)); -	time_start = time(NULL); +	uniforms->time = glGetUniformLocation(shader, "time"); +	uniforms->window = glGetUniformLocation(shader, "window"); + +	return uniforms;  }  /** @brief update `uniform float time` */ -static void update_u_time() { +static void update_u_time(GLuint u_time) {  	struct timeval t;  	gettimeofday(&t, NULL);  	t.tv_sec -= time_start; @@ -27,14 +29,14 @@ static void update_u_time() {  }  /** @brief update `uniform ivec2 window` */ -static void update_u_window() { +static void update_u_window(GLuint u_window) {  	int width, height;  	glfwGetWindowSize(window, &width, &height);  	glUniform2i(u_window, width, height);  } -void update_uniform() { -	update_u_time(); -	update_u_window(); +void update_uniforms(uniforms_t * uniforms) { +	update_u_time(uniforms->time); +	update_u_window(uniforms->window);  }  |