aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@digia.com>2014-04-08 15:05:21 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-23 12:23:09 +0200
commite950557e1133e8aac65a453597ab35400a5b9a10 (patch)
tree835e04f12a584274cec65efaa6071001247417ee /src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
parent8a28462c13907800caf44c16580e0b2a2ee99f69 (diff)
Avoid direct GL calls in Quick
Change-Id: I9b8673fb3292c9d5ad2f9e8e63f56dc661699be6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/quick/scenegraph/qsgdefaultglyphnode_p.cpp')
-rw-r--r--src/quick/scenegraph/qsgdefaultglyphnode_p.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
index cd462f2fb8..a69cbc54ea 100644
--- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
+++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
@@ -125,13 +125,14 @@ void QSGTextMaskShader::updateState(const RenderState &state, QSGMaterial *newEf
|| oldMaterial->texture()->textureId() != material->texture()->textureId()) {
program()->setUniformValue(m_textureScale_id, QVector2D(1.0 / material->cacheTextureWidth(),
1.0 / material->cacheTextureHeight()));
- glBindTexture(GL_TEXTURE_2D, material->texture()->textureId());
+ QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
+ funcs->glBindTexture(GL_TEXTURE_2D, material->texture()->textureId());
// Set the mag/min filters to be nearest. We only need to do this when the texture
// has been recreated.
if (updated) {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
}
@@ -215,16 +216,18 @@ void QSG24BitTextMaskShader::initialize()
void QSG24BitTextMaskShader::activate()
{
- glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_SRC_COLOR);
+ QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
+ funcs->glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_SRC_COLOR);
if (m_useSRGB)
- glEnable(GL_FRAMEBUFFER_SRGB);
+ funcs->glEnable(GL_FRAMEBUFFER_SRGB);
}
void QSG24BitTextMaskShader::deactivate()
{
- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
+ funcs->glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
if (m_useSRGB)
- glDisable(GL_FRAMEBUFFER_SRGB);
+ funcs->glDisable(GL_FRAMEBUFFER_SRGB);
}
static inline qreal qt_sRGB_to_linear_RGB(qreal f)
@@ -250,7 +253,7 @@ void QSG24BitTextMaskShader::updateState(const RenderState &state, QSGMaterial *
QVector4D color = material->color();
if (m_useSRGB)
color = qt_sRGB_to_linear_RGB(color);
- state.context()->functions()->glBlendColor(color.x(), color.y(), color.z(), color.w());
+ QOpenGLContext::currentContext()->functions()->glBlendColor(color.x(), color.y(), color.z(), color.w());
color = qsg_premultiply(color, state.opacity());
program()->setUniformValue(m_color_id, color.w());
}
@@ -313,13 +316,14 @@ void QSGStyledTextShader::updateState(const RenderState &state,
|| oldMaterial->texture()->textureId() != material->texture()->textureId()) {
program()->setUniformValue(m_textureScale_id, QVector2D(1.0 / material->cacheTextureWidth(),
1.0 / material->cacheTextureHeight()));
- glBindTexture(GL_TEXTURE_2D, material->texture()->textureId());
+ QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
+ funcs->glBindTexture(GL_TEXTURE_2D, material->texture()->textureId());
// Set the mag/min filters to be linear. We only need to do this when the texture
// has been recreated.
if (updated) {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
}