diff options
author | Wieland Hagen <wieland.hagen@kdab.com> | 2016-12-21 23:03:22 +0700 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2017-01-12 11:54:37 +0000 |
commit | 43d7e7cb6e02fe0c0743d2441a7d2726ed9260b4 (patch) | |
tree | 0ab4bacff0e22ad2dd9aec9a81c79f58dab7a3ee | |
parent | 90f732cb082be5e9f959c8bbb6d61a5dfe5c04fe (diff) |
Ignore textures which don't have their texture data yet
Change-Id: Iac5441808ea98a56b6e6890519f62b2b2178f2cc
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
-rw-r--r-- | src/render/graphicshelpers/graphicscontext.cpp | 2 | ||||
-rw-r--r-- | src/render/texture/gltexture.cpp | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/render/graphicshelpers/graphicscontext.cpp b/src/render/graphicshelpers/graphicscontext.cpp index 919ae5bd6..aba74c8d9 100644 --- a/src/render/graphicshelpers/graphicscontext.cpp +++ b/src/render/graphicshelpers/graphicscontext.cpp @@ -646,6 +646,8 @@ int GraphicsContext::activateTexture(TextureScope scope, GLTexture *tex, int onU // Note: tex->dna() could be 0 if the texture has not been created yet if (m_activeTextures[onUnit].texture != tex) { QOpenGLTexture *glTex = tex->getOrCreateGLTexture(); + if (glTex == nullptr) + return -1; glTex->bind(onUnit); m_activeTextures[onUnit].texture = tex; } diff --git a/src/render/texture/gltexture.cpp b/src/render/texture/gltexture.cpp index 0e3291fb0..0fc37891d 100644 --- a/src/render/texture/gltexture.cpp +++ b/src/render/texture/gltexture.cpp @@ -138,8 +138,8 @@ QOpenGLTexture* GLTexture::getOrCreateGLTexture() m_dirty |= Properties; needUpload = true; } else { - qWarning() << "[Qt3DRender::GLTexture] No QTextureData generated from Texture Generator"; - texturedDataInvalid = true; + qWarning() << "[Qt3DRender::GLTexture] No QTextureData generated from Texture Generator yet. Texture will be invalid for this frame"; + return nullptr; } } @@ -171,12 +171,14 @@ QOpenGLTexture* GLTexture::getOrCreateGLTexture() m_dirty |= Properties; } } else { - qWarning() << "[Qt3DRender::GLTexture] No QTextureImageData generated from functor"; + qWarning() << "[Qt3DRender::GLTexture] No QTextureImageData generated from functor yet, texture will be invalid for this frame"; texturedDataInvalid = true; } } } + if (texturedDataInvalid) + return nullptr; // if the properties changed, we need to re-allocate the texture if (m_dirty.testFlag(Properties)) { |