aboutsummaryrefslogtreecommitdiff
path: root/src/graphics/texture.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphics/texture.c')
-rw-r--r--src/graphics/texture.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/graphics/texture.c b/src/graphics/texture.c
index 7d8fdcf..fb8c1e5 100644
--- a/src/graphics/texture.c
+++ b/src/graphics/texture.c
@@ -5,6 +5,8 @@
/* TODO: Check for glTexImage2D/glTexSubImage2D failure */
+static const mgl_texture *current_texture = NULL;
+
static int mgl_texture_format_to_opengl_format(mgl_texture_format format) {
switch(format) {
case MGL_TEXTURE_FORMAT_ALPHA: return GL_ALPHA8;
@@ -153,6 +155,7 @@ int mgl_texture_resize(mgl_texture *self, int new_width, int new_height, mgl_tex
void mgl_texture_use(const mgl_texture *texture) {
mgl_context *context = mgl_get_context();
+ current_texture = texture;
if(texture) {
float matrix[16] = {
1.0f, 0.0f, 0.0f, 0.0f,
@@ -176,6 +179,10 @@ void mgl_texture_use(const mgl_texture *texture) {
}
}
+const mgl_texture* mgl_texture_current_texture(void) {
+ return current_texture;
+}
+
void mgl_texture_unload(mgl_texture *self) {
mgl_context *context = mgl_get_context();
if(self->id) {