Set some state before rendering the EGL/GLES mouse cursor

Custom OpenGL rendering code often sets these and, unlike the Quick scenegraph,
may not reset it before calling swapBuffers(). Play nice with the most commmon
settings.

Resetting the active texture unit is critical in particular, since frameworks
like Qt3D will change this.

Change-Id: I86acaf7e0b2ce67a23c731fffce4f20375614321
Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
This commit is contained in:
Laszlo Agocs 2014-11-27 14:42:34 +01:00
parent f246e380c3
commit b066467be7
1 changed files with 3 additions and 0 deletions

View File

@ -363,6 +363,7 @@ void QEGLPlatformCursor::draw(const QRectF &r)
s2, t1
};
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, m_cursor.texture);
glBindBuffer(GL_ARRAY_BUFFER, 0);
@ -374,6 +375,8 @@ void QEGLPlatformCursor::draw(const QRectF &r)
m_program->setUniformValue(m_textureEntry, 0);
glDisable(GL_CULL_FACE);
glFrontFace(GL_CCW);
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glDisable(GL_DEPTH_TEST); // disable depth testing to make sure cursor is always on top