1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#ifndef TEXTURE_H
#define TEXTURE_H
#include "types.h"
#include "my_math.h"
#include <GL/glew.h>
typedef struct {
u32 id;
const char *name;
u32 width, height;
u32 internal_format;
u32 image_format;
u32 wrap_s;
u32 wrap_t;
u32 min_filter;
u32 mag_filter;
} gl_texture_t;
#define default_texture {0, 0, 0, 0, GL_RGB, GL_RGB, GL_REPEAT, GL_REPEAT, GL_NEAREST, GL_NEAREST}
#define MAX_TEXTURES 16
extern gl_texture_t textures[MAX_TEXTURES];
extern void generate_texture(gl_texture_t *texture, u32 width, u32 height, void *data);
extern gl_texture_t load_texture(const char *dir, const char *filename, const char *name, i32 alpha);
extern u32 get_texture_id(const char *name);
extern v2 get_texture_size(const char *name);
#endif
|