summaryrefslogtreecommitdiff
path: root/in_practice/breakout/texture.h
diff options
context:
space:
mode:
authorpryazha <pryadeiniv@mail.ru>2025-08-16 10:11:00 +0500
committerpryazha <pryadeiniv@mail.ru>2025-08-16 10:11:00 +0500
commit1f93c3ef62af6c71217f06491ca2b859d4065740 (patch)
tree4f07192788df29446aa1ddb73a20839e4ddf9b3f /in_practice/breakout/texture.h
parent99337878eca2807436bcf11d36946b90db44a2d3 (diff)
in practice chapter
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