summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index b46095d..d8400ee 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2,6 +2,7 @@
#include "texture.h"
#include <glad/glad.h>
#include <GLFW/glfw3.h>
+#include <cglm/cglm.h>
#include <stdio.h>
#include <stdlib.h>
@@ -10,6 +11,12 @@ extern unsigned char src_fragment_glsl[];
static void framebuffer_size_callback(GLFWwindow *window, int w, int h);
+static float
+radians(float x)
+{
+ return x * 0.01745329f;
+}
+
int
main([[maybe_unused]] int argc, [[maybe_unused]] char **argv)
{
@@ -95,6 +102,10 @@ main([[maybe_unused]] int argc, [[maybe_unused]] char **argv)
const GLint vertex_color_location =
shader_uniform_location(&shader, "ourColor");
+ mat4 trans = GLM_MAT4_IDENTITY_INIT;
+ glm_rotate(trans, radians(90), (vec3){0.0f, 0.0f, 1.0f});
+ glm_scale(trans, (vec3){0.5f, 0.5f, 0.5f});
+
//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, GL_LINEAR);
@@ -106,6 +117,9 @@ main([[maybe_unused]] int argc, [[maybe_unused]] char **argv)
!(r&1), !(r&2), !(r&4), !(r&8));
glUniform1i(shader_uniform_location(&shader, "texture0"), 0);
glUniform1i(shader_uniform_location(&shader, "texture1"), 1);
+ glUniformMatrix4fv(shader_uniform_location(&shader,
+ "transform"),
+ 1, GL_FALSE, trans[0]);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texture.id);
glActiveTexture(GL_TEXTURE1);