/** * Copyright (c) 2026 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #pragma once #include "dusk.h" typedef union texturedata_u texturedata_t; typedef enum { TEXTURE_FORMAT_RGBA = GL_RGBA, TEXTURE_FORMAT_PALETTE = GL_COLOR_INDEX8_EXT, // TEXTURE_FORMAT_DXT5 = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT } textureformatgl_t; typedef struct { GLuint id; textureformatgl_t format; int32_t width; int32_t height; union { palette_t *palette; }; } texturegl_t; /** * Initializes a texture. * * @param texture The texture to initialize. * @param width The width of the texture. * @param height The height of the texture. * @param format The format of the texture (e.g., GL_RGBA, GL_ALPHA). * @param data The data for the texture, the format changes per format. * @return An error if the texture failed to initialize, otherwise success. */ errorret_t textureInitGL( texturegl_t *texture, const int32_t width, const int32_t height, const textureformatgl_t format, const texturedata_t data ); /** * Disposes a texture. * * @param texture The texture to dispose. * @return An error if the texture failed to dispose, otherwise success. */ errorret_t textureDisposeGL(texturegl_t *texture);