From 7ee585bbffb4350ec327116d30cd63e3d1142581 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 29 Jan 2016 10:06:10 +0100 Subject: Don't resolve GL 1 symbols in the texture helper We already have these symbols resolved in QOpenGLFunctions, so simply use those. Change-Id: I6047181dbe47be9b0a83656af454d0ca1f3df6eb Reviewed-by: Laszlo Agocs Reviewed-by: Sean Harmer --- src/gui/opengl/qopengltexture.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'src/gui/opengl/qopengltexture.cpp') diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp index a0b482e1d2a..23ae5febc03 100644 --- a/src/gui/opengl/qopengltexture.cpp +++ b/src/gui/opengl/qopengltexture.cpp @@ -81,7 +81,8 @@ QOpenGLTexturePrivate::QOpenGLTexturePrivate(QOpenGLTexture::Target textureTarge textureView(false), autoGenerateMipMaps(true), storageAllocated(false), - texFuncs(0) + texFuncs(0), + functions(0) { dimensions[0] = dimensions[1] = dimensions[2] = 1; @@ -165,6 +166,7 @@ bool QOpenGLTexturePrivate::create() return false; } context = ctx; + functions = ctx->functions(); // Resolve any functions we will need based upon context version and create the texture initializeOpenGLFunctions(); @@ -177,7 +179,7 @@ bool QOpenGLTexturePrivate::create() feature = static_cast(feature << 1); } - texFuncs->glGenTextures(1, &textureId); + functions->glGenTextures(1, &textureId); return textureId != 0; } @@ -194,9 +196,10 @@ void QOpenGLTexturePrivate::destroy() return; } - texFuncs->glDeleteTextures(1, &textureId); + functions->glDeleteTextures(1, &textureId); context = 0; + functions = 0; textureId = 0; format = QOpenGLTexture::NoFormat; formatClass = QOpenGLTexture::NoFormatClass; @@ -231,17 +234,17 @@ void QOpenGLTexturePrivate::destroy() void QOpenGLTexturePrivate::bind() { - texFuncs->glBindTexture(target, textureId); + functions->glBindTexture(target, textureId); } void QOpenGLTexturePrivate::bind(uint unit, QOpenGLTexture::TextureUnitReset reset) { GLint oldTextureUnit = 0; if (reset == QOpenGLTexture::ResetTextureUnit) - texFuncs->glGetIntegerv(GL_ACTIVE_TEXTURE, &oldTextureUnit); + functions->glGetIntegerv(GL_ACTIVE_TEXTURE, &oldTextureUnit); texFuncs->glActiveTexture(GL_TEXTURE0 + unit); - texFuncs->glBindTexture(target, textureId); + functions->glBindTexture(target, textureId); if (reset == QOpenGLTexture::ResetTextureUnit) texFuncs->glActiveTexture(GL_TEXTURE0 + oldTextureUnit); @@ -249,17 +252,17 @@ void QOpenGLTexturePrivate::bind(uint unit, QOpenGLTexture::TextureUnitReset res void QOpenGLTexturePrivate::release() { - texFuncs->glBindTexture(target, 0); + functions->glBindTexture(target, 0); } void QOpenGLTexturePrivate::release(uint unit, QOpenGLTexture::TextureUnitReset reset) { GLint oldTextureUnit = 0; if (reset == QOpenGLTexture::ResetTextureUnit) - texFuncs->glGetIntegerv(GL_ACTIVE_TEXTURE, &oldTextureUnit); + functions->glGetIntegerv(GL_ACTIVE_TEXTURE, &oldTextureUnit); texFuncs->glActiveTexture(GL_TEXTURE0 + unit); - texFuncs->glBindTexture(target, 0); + functions->glBindTexture(target, 0); if (reset == QOpenGLTexture::ResetTextureUnit) texFuncs->glActiveTexture(GL_TEXTURE0 + oldTextureUnit); @@ -268,18 +271,18 @@ void QOpenGLTexturePrivate::release(uint unit, QOpenGLTexture::TextureUnitReset bool QOpenGLTexturePrivate::isBound() const { GLint boundTextureId = 0; - texFuncs->glGetIntegerv(bindingTarget, &boundTextureId); + functions->glGetIntegerv(bindingTarget, &boundTextureId); return (static_cast(boundTextureId) == textureId); } bool QOpenGLTexturePrivate::isBound(uint unit) const { GLint oldTextureUnit = 0; - texFuncs->glGetIntegerv(GL_ACTIVE_TEXTURE, &oldTextureUnit); + functions->glGetIntegerv(GL_ACTIVE_TEXTURE, &oldTextureUnit); GLint boundTextureId = 0; texFuncs->glActiveTexture(GL_TEXTURE0 + unit); - texFuncs->glGetIntegerv(bindingTarget, &boundTextureId); + functions->glGetIntegerv(bindingTarget, &boundTextureId); bool result = (static_cast(boundTextureId) == textureId); texFuncs->glActiveTexture(GL_TEXTURE0 + oldTextureUnit); -- cgit v1.2.3