From 017b3f9dc7441500d5cacf724a255b047bf18ac1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 27 Dec 2018 14:23:02 +0100 Subject: [PATCH] - fixed OpenGL texture objects weren't deleted when a texture was destroyed. --- src/gl/textures/gl_hwtexture.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gl/textures/gl_hwtexture.cpp b/src/gl/textures/gl_hwtexture.cpp index 9c5f7b894..e4736f4d6 100644 --- a/src/gl/textures/gl_hwtexture.cpp +++ b/src/gl/textures/gl_hwtexture.cpp @@ -97,7 +97,10 @@ unsigned int FHardwareTexture::CreateTexture(unsigned char * buffer, int w, int } */ bool firstCall = glTexID == 0; - if (firstCall) glGenTextures(1,&glTexID); + if (firstCall) + { + glGenTextures(1, &glTexID); + } int textureBinding = UINT_MAX; if (texunit == -1) glGetIntegerv(GL_TEXTURE_BINDING_2D, &textureBinding); @@ -211,7 +214,8 @@ uint8_t *FHardwareTexture::MapBuffer() //=========================================================================== FHardwareTexture::~FHardwareTexture() { - glDeleteBuffers(1, &glBufferID); + if (glTexID != 0) glDeleteTextures(1, &glTexID); + if (glBufferID != 0) glDeleteBuffers(1, &glBufferID); }