Commit 01b162ad authored by Jean-Paul Saman's avatar Jean-Paul Saman

src/utils_glx.c: implement gl_destroy_texture()

The API offered a gl_create_texture() but not and gl_destroy_texture().
parent 42be4519
......@@ -455,6 +455,8 @@ gl_destroy_context(GLContextState *cs)
cs->display = NULL;
cs->context = NULL;
}
glDisable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
free(cs);
}
......@@ -775,6 +777,29 @@ gl_get_vtable(void)
return gl_vtable;
}
/**
* gl_destroy_texture:
* @texture: the texture to destroy
* @target: the target to which the texture is bound
*
* Delete a texture.
*
* Return value: nothing
*/
void
gl_destroy_texture(
GLuint *texture,
GLenum target
)
{
if (*texture == 0)
abort();
glEnable(target);
glDeleteTextures(1, texture);
glDisable(target);
}
/**
* gl_create_texture:
* @target: the target to which the texture is bound
......@@ -881,6 +906,7 @@ gl_create_texture(
break;
}
glBindTexture(target, 0);
glDisable(target);
return texture;
}
......@@ -938,7 +964,7 @@ gl_destroy_texture_object(GLTextureObject *to)
return;
if (to->texture) {
glDeleteTextures(1, &to->texture);
gl_destroy_texture(&to->texture, to->target);
to->texture = 0;
}
free(to);
......
......@@ -166,6 +166,12 @@ gl_create_texture(
unsigned int height
) attribute_hidden;
void
gl_destroy_texture(
GLuint *texture,
GLenum target
) attribute_hidden;
GLTextureObject *
gl_create_texture_object(
GLenum target,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment