diff options
author | lonkaars <loek@pipeframe.xyz> | 2024-05-18 10:58:08 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2024-05-18 10:58:08 +0200 |
commit | 1f24a2196641f7d832300fd45c7f5e89559ecc34 (patch) | |
tree | dd9316c305118d269f9043a421bf7af9273a6723 /uniform.c | |
parent | e74b821cf13869a99ac2933493207680d6666186 (diff) |
more problem isolation
Diffstat (limited to 'uniform.c')
-rw-r--r-- | uniform.c | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/uniform.c b/uniform.c deleted file mode 100644 index 6c66b7a..0000000 --- a/uniform.c +++ /dev/null @@ -1,40 +0,0 @@ -#include <sys/time.h> -#include <time.h> -#include <GL/glew.h> - -#include "uniform.h" - -int time_start = 0; -GLFWwindow* window = NULL; -GLint u_time, u_window; - -void init_uniform(GLuint shader, GLFWwindow* _window) { - window = _window; - - u_time = glGetUniformLocation(shader, "time"); - u_window = glGetUniformLocation(shader, "window"); - - time_start = time(NULL); -} - -/** @brief update `uniform float time` */ -static void update_u_time() { - struct timeval t; - gettimeofday(&t, NULL); - t.tv_sec -= time_start; - float time = t.tv_sec + (t.tv_usec / 1e6); - glUniform1f(u_time, time); -} - -/** @brief update `uniform ivec2 window` */ -static void update_u_window() { - int width, height; - glfwGetWindowSize(window, &width, &height); - glUniform2i(u_window, width, height); -} - -void update_uniform() { - update_u_time(); - update_u_window(); -} - |