summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl/qopengltexture.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2016-01-29 10:06:10 +0100
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2016-03-01 14:46:11 +0000
commit7ee585bbffb4350ec327116d30cd63e3d1142581 (patch)
treebf387974dce5d4b8d2b24ac4e953c94ff9d63f61 /src/gui/opengl/qopengltexture.cpp
parent8611d442fc5d8020328889b023e0ab1c5d98ced6 (diff)
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 <laszlo.agocs@theqtcompany.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/gui/opengl/qopengltexture.cpp')
-rw-r--r--src/gui/opengl/qopengltexture.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp
index a0b482e1d2..23ae5febc0 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<QOpenGLTexture::Feature>(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<GLuint>(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<GLuint>(boundTextureId) == textureId);
texFuncs->glActiveTexture(GL_TEXTURE0 + oldTextureUnit);