From 0f240d39b61905313bd76127752d393cf65b6ff4 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Mon, 18 Jul 2016 11:21:09 -0700 Subject: [PATCH] Actually delete textures we're not using --- libraries/gpu-gl/src/gpu/gl/GLTexture.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/gpu-gl/src/gpu/gl/GLTexture.cpp b/libraries/gpu-gl/src/gpu/gl/GLTexture.cpp index ed931437b7..74428b53f5 100644 --- a/libraries/gpu-gl/src/gpu/gl/GLTexture.cpp +++ b/libraries/gpu-gl/src/gpu/gl/GLTexture.cpp @@ -187,7 +187,11 @@ GLTexture::~GLTexture() { } } - Backend::decrementTextureGPUCount(); + if (_id) { + glDeleteTextures(1, &_id); + const_cast(_id) = 0; + Backend::decrementTextureGPUCount(); + } Backend::updateTextureGPUMemoryUsage(_size, 0); Backend::updateTextureGPUVirtualMemoryUsage(_virtualSize, 0); }