summaryrefslogtreecommitdiff
path: root/in_practice/breakout/texture.h
diff options
context:
space:
mode:
Diffstat (limited to 'in_practice/breakout/texture.h')
-rw-r--r--in_practice/breakout/texture.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/in_practice/breakout/texture.h b/in_practice/breakout/texture.h
new file mode 100644
index 0000000..2e9d867
--- /dev/null
+++ b/in_practice/breakout/texture.h
@@ -0,0 +1,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 8
+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