diff options
author | Michael Brasser <michael.brasser@live.com> | 2013-04-30 13:06:44 -0500 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-05-03 19:11:18 +0200 |
commit | ddfa42c85b732972f819a2525293a90539d42d38 (patch) | |
tree | 74149ef6fdb51f5418975fdcaace8ebce92d0fc9 /examples/quick | |
parent | 9d6cd72353e4862592c016951810abf9a7ab8079 (diff) |
Better handle GL errors in EtcTexture::bind().
The scenegraph as a whole does not typically do GL error checking. That
means GL errors occurring elsewhere could cause the etcprovider to unload
textures that loaded correctly.
Change-Id: Ic8e0caa62dab50b391e226cf0a493bc7e357dc46
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'examples/quick')
-rw-r--r-- | examples/quick/textureprovider/etcprovider.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/quick/textureprovider/etcprovider.cpp b/examples/quick/textureprovider/etcprovider.cpp index 52c2c17cfe..04545fe830 100644 --- a/examples/quick/textureprovider/etcprovider.cpp +++ b/examples/quick/textureprovider/etcprovider.cpp @@ -121,6 +121,10 @@ void EtcTexture::bind() "paddedWidth: " << m_paddedSize.width() << "paddedHeight: " << m_paddedSize.height(); #endif +#ifndef QT_NO_DEBUG + while (glGetError() != GL_NO_ERROR) { } +#endif + QOpenGLContext *ctx = QOpenGLContext::currentContext(); Q_ASSERT(ctx != 0); ctx->functions()->glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_ETC1_RGB8_OES, @@ -128,6 +132,7 @@ void EtcTexture::bind() (m_paddedSize.width() * m_paddedSize.height()) >> 1, m_data.data() + 16); +#ifndef QT_NO_DEBUG // Gracefully fail in case of an error... GLuint error = glGetError(); if (error != GL_NO_ERROR) { @@ -137,6 +142,7 @@ void EtcTexture::bind() m_texture_id = 0; return; } +#endif m_uploaded = true; updateBindOptions(true); |