From a03290bd7e988294ec8167dc17865bb94b478f7b Mon Sep 17 00:00:00 2001 From: Charles Yin Date: Wed, 16 May 2012 16:05:06 +1000 Subject: [PATCH] Only genereate new texture if texture id is 0 Otherwise a new texture would be created for accessing textureId() function everytime and even worse thing is these textures will never been deleted and eventually cause gl out of memory. Change-Id: I349fcf15b5aeabbd9420a8dd645e0fdcc1d256bf Reviewed-by: Glenn Watson --- src/quick/scenegraph/util/qsgtexture.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quick/scenegraph/util/qsgtexture.cpp b/src/quick/scenegraph/util/qsgtexture.cpp index 69ae317..a380d6e 100644 --- a/src/quick/scenegraph/util/qsgtexture.cpp +++ b/src/quick/scenegraph/util/qsgtexture.cpp @@ -499,7 +499,7 @@ int QSGPlainTexture::textureId() const // The actual texture and id will be updated/deleted in a later bind() // or ~QSGPlainTexture so just keep it minimal here. return 0; - } else { + } else if (m_texture_id == 0){ // Generate a texture id for use later and return it. glGenTextures(1, &const_cast(this)->m_texture_id); return m_texture_id; -- 2.7.4