From 1f93c3ef62af6c71217f06491ca2b859d4065740 Mon Sep 17 00:00:00 2001 From: pryazha Date: Sat, 16 Aug 2025 10:11:00 +0500 Subject: in practice chapter --- in_practice/breakout/texture.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 in_practice/breakout/texture.h (limited to 'in_practice/breakout/texture.h') 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 + +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 -- cgit v1.2.3-70-g09d2