diff options
author | dec05eba <dec05eba@protonmail.com> | 2025-04-14 23:13:50 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2025-04-14 23:13:50 +0200 |
commit | 0243be4eebe488b449742474d4301a39f00ac67f (patch) | |
tree | b1109991e8a3da169e562f9878769b99ffd3820f /include | |
parent | 46962ea3fc83a26fcf0851ccb748b08eecf7f8e8 (diff) |
Add scaling option for texture, allow nearest neighbour scaling
Diffstat (limited to 'include')
-rw-r--r-- | include/mgl/gl_macro.h | 1 | ||||
-rw-r--r-- | include/mgl/graphics/texture.h | 11 |
2 files changed, 10 insertions, 2 deletions
diff --git a/include/mgl/gl_macro.h b/include/mgl/gl_macro.h index 07ce1c4..574a3d8 100644 --- a/include/mgl/gl_macro.h +++ b/include/mgl/gl_macro.h @@ -48,6 +48,7 @@ #define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 #define GL_CLAMP_TO_EDGE 0x812F +#define GL_NEAREST 0x2600 #define GL_LINEAR 0x2601 #define GL_LINEAR_MIPMAP_LINEAR 0x2703 diff --git a/include/mgl/graphics/texture.h b/include/mgl/graphics/texture.h index d65adee..b658daf 100644 --- a/include/mgl/graphics/texture.h +++ b/include/mgl/graphics/texture.h @@ -14,6 +14,12 @@ typedef enum { MGL_TEXTURE_FORMAT_RGBA } mgl_texture_format; +typedef enum { + MGL_TEXTURE_SCALE_NEAREST, + MGL_TEXTURE_SCALE_LINEAR, + MGL_TEXTURE_SCALE_LINEAR_MIPMAP /* generate mipmaps (available since opengl 3.0) */ +} mgl_texture_scale_type; + struct mgl_texture { unsigned int id; int width; @@ -22,18 +28,19 @@ struct mgl_texture { int max_width; int max_height; bool pixel_coordinates; - bool mipmap; + mgl_texture_scale_type scale_type; bool owned; }; typedef struct { bool compressed; /* false by default */ bool pixel_coordinates; /* false by default, texture coordinates are normalized */ - bool mipmap; /* false by default, generate mipmaps (available since opengl 3.0) */ + mgl_texture_scale_type scale_type; /* MGL_TEXTURE_SCALE_LINEAR by default */ } mgl_texture_load_options; typedef struct { bool pixel_coordinates; /* false by default, texture coordinates are normalized */ + mgl_texture_scale_type scale_type; /* MGL_TEXTURE_SCALE_LINEAR by default */ } mgl_texture_reference_options; int mgl_texture_init(mgl_texture *self); |