summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-11-03 19:48:26 -0400
committerpommicket <pommicket@gmail.com>2022-11-03 19:48:26 -0400
commit7a2b3ea8c13657ef697d0b4dc73ccada23f81039 (patch)
tree0b3702b9bce4536047525d2f472a937d6e06d039 /main.c
parent4d995edfdde5953bc5669c54b1194be40a3641f2 (diff)
custom shader texture
Diffstat (limited to 'main.c')
-rw-r--r--main.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/main.c b/main.c
index 8fc0ca3..dbc49d5 100644
--- a/main.c
+++ b/main.c
@@ -1,6 +1,5 @@
/*
FUTURE FEATURES:
-- custom shaders texture
- config variables
- plugins?
*/
@@ -811,6 +810,15 @@ int main(int argc, char **argv) {
glUniform1f(glGetUniformLocation(shader, "t_time"), (float)fmod(t - start_time, 3600));
glUniform2f(glGetUniformLocation(shader, "t_aspect"), (float)window_width / (float)window_height, 1);
glUniform1f(glGetUniformLocation(shader, "t_save_time"), (float)(t - ted->last_save_time));
+ if (s->bg_texture) {
+ GLuint texture = s->bg_texture->texture;
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, texture);
+ glUniform1i(glGetUniformLocation(shader, "t_texture"), 0);
+ } else {
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, 0);
+ }
glBindBuffer(GL_ARRAY_BUFFER, buffer);
if (!array) {
GLuint v_pos = (GLuint)glGetAttribLocation(shader, "v_pos");