summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorJorgen Lind <jorgen.lind@digia.com>2013-11-28 14:46:59 +0100
committerJørgen Lind <jorgen.lind@digia.com>2013-11-28 15:41:35 +0100
commita8773f5263642ba2750ca94a6025806e9e78e909 (patch)
tree57b9495370f19461e44ada1345b47bd5d4418c01 /src/plugins
parentfebdea5d72693a5d859d6b8b992495f1af5aabf8 (diff)
Fix the override of glBindFrameBufferObject when parameter is 0
and fix a couple of warnings Change-Id: I77b692ea66df0f692017c3d16660701c09297e1d Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/qwayland-egl/qwaylandglcontext.cpp18
-rw-r--r--src/plugins/platforms/qwayland-egl/qwaylandglcontext.h1
2 files changed, 13 insertions, 6 deletions
diff --git a/src/plugins/platforms/qwayland-egl/qwaylandglcontext.cpp b/src/plugins/platforms/qwayland-egl/qwaylandglcontext.cpp
index 278359bea..92d79db36 100644
--- a/src/plugins/platforms/qwayland-egl/qwaylandglcontext.cpp
+++ b/src/plugins/platforms/qwayland-egl/qwaylandglcontext.cpp
@@ -64,6 +64,7 @@ QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, const QSurfaceFormat
, m_format(q_glFormatFromConfig(m_eglDisplay, m_config))
, m_blitProgram(0)
, m_textureCache(0)
+ , mUseNativeDefaultFbo(false)
{
m_shareEGLContext = share ? static_cast<QWaylandGLContext *>(share)->eglContext() : EGL_NO_CONTEXT;
@@ -107,9 +108,6 @@ QWaylandGLContext::~QWaylandGLContext()
bool QWaylandGLContext::makeCurrent(QPlatformSurface *surface)
{
- if (!isInitialized(QOpenGLFunctions::d_ptr))
- initializeOpenGLFunctions();
-
QWaylandEglWindow *window = static_cast<QWaylandEglWindow *>(surface);
window->setCanResize(false);
@@ -139,6 +137,7 @@ void QWaylandGLContext::swapBuffers(QPlatformSurface *surface)
if (window->decoration()) {
makeCurrent(surface);
if (!m_blitProgram) {
+ initializeOpenGLFunctions();
m_blitProgram = new QOpenGLShaderProgram();
m_blitProgram->addShaderFromSourceCode(QOpenGLShader::Vertex, "attribute vec4 position;\n\
attribute vec4 texCoords;\n\
@@ -165,9 +164,14 @@ void QWaylandGLContext::swapBuffers(QPlatformSurface *surface)
m_textureCache = new QOpenGLTextureCache(this->context());
}
+ QRect windowRect = window->window()->frameGeometry();
+ glViewport(0, 0, windowRect.width(), windowRect.height());
+
glDisable(GL_DEPTH_TEST);
glDisable(GL_BLEND);
+ mUseNativeDefaultFbo = true;
glBindFramebuffer(GL_FRAMEBUFFER, 0);
+ mUseNativeDefaultFbo = false;
static const GLfloat squareVertices[] = {
-1.f, -1.f,
@@ -190,13 +194,14 @@ void QWaylandGLContext::swapBuffers(QPlatformSurface *surface)
1.0f, 1.0f,
};
+ m_blitProgram->bind();
+
m_blitProgram->setUniformValue("texture", 0);
m_blitProgram->enableAttributeArray("position");
m_blitProgram->enableAttributeArray("texCoords");
m_blitProgram->setAttributeArray("texCoords", textureVertices, 2);
- m_blitProgram->bind();
glActiveTexture(GL_TEXTURE0);
//Draw Decoration
@@ -205,8 +210,6 @@ void QWaylandGLContext::swapBuffers(QPlatformSurface *surface)
m_textureCache->bindTexture(context(), decorationImage);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- QRect windowRect = window->window()->frameGeometry();
- glViewport(0, 0, windowRect.width(), windowRect.height());
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
//Draw Content
@@ -229,6 +232,9 @@ void QWaylandGLContext::swapBuffers(QPlatformSurface *surface)
GLuint QWaylandGLContext::defaultFramebufferObject(QPlatformSurface *surface) const
{
+ if (mUseNativeDefaultFbo)
+ return 0;
+
return static_cast<QWaylandEglWindow *>(surface)->contentFBO();
}
diff --git a/src/plugins/platforms/qwayland-egl/qwaylandglcontext.h b/src/plugins/platforms/qwayland-egl/qwaylandglcontext.h
index 3e1eb3e73..a0750bd87 100644
--- a/src/plugins/platforms/qwayland-egl/qwaylandglcontext.h
+++ b/src/plugins/platforms/qwayland-egl/qwaylandglcontext.h
@@ -88,6 +88,7 @@ private:
QSurfaceFormat m_format;
QOpenGLShaderProgram *m_blitProgram;
QOpenGLTextureCache *m_textureCache;
+ bool mUseNativeDefaultFbo;
};
QT_END_NAMESPACE