summaryrefslogtreecommitdiff
path: root/src/shader.h
blob: 931dd3349d2882425fba01bac6c315d0c6dc5a60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#pragma once

#include <GL/gl.h>
#include <cglm/cglm.h>

typedef struct {
	GLuint program_id;
	GLuint vertex_id;
	GLuint fragment_id;
	int attributes;
} Shader;

Shader *shader_init(const char *vertexFile, const char *fragmentFile);
void shader_bind(Shader *shader);
void shader_unbind(void);
void shader_free(Shader *shader);

GLint shader_uniform_location(Shader *shader, const char *name);
void shader_loadf(GLint location, float value);
void shader_loadi(GLint location, int value);
void shader_loadv3f(GLint location, vec3 value);
void shader_loadm4f(GLint location, mat4 value);