46 lines
926 B
C
46 lines
926 B
C
/**
|
|
* Copyright (c) 2025 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "dusksdl2.h"
|
|
|
|
typedef struct {
|
|
GLuint id;
|
|
int32_t width;
|
|
int32_t height;
|
|
} texture_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 pixel data for the texture.
|
|
*/
|
|
void textureInit(
|
|
texture_t *texture,
|
|
const int32_t width,
|
|
const int32_t height,
|
|
const GLenum format,
|
|
const uint8_t *data
|
|
);
|
|
|
|
/**
|
|
* Binds a texture for rendering.
|
|
*
|
|
* @param texture The texture to bind.
|
|
*/
|
|
void textureBind(const texture_t *texture);
|
|
|
|
/**
|
|
* Disposes a texture.
|
|
*
|
|
* @param texture The texture to dispose.
|
|
*/
|
|
void textureDispose(texture_t *texture); |