summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2014-12-16 16:31:37 +0100
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2014-12-21 07:02:23 +0100
commitf2663f2ae4fabe975d2e2d5e3fe3afa4666e92f8 (patch)
tree80932e51e48dc63b3a51e5c5eb65fb767913bf36 /src/widgets
parente78ec1c48aa9e8912fe9ef96d5f0eb7ef66feadf (diff)
Fix discard framebuffer support in QOpenGLWidget
The enum values are different for the default framebuffer and non-default ones. With QOpenGLWidget there is always a non-default fb bound, so the correct way is to use GL_COLOR_ATTACHMENT0 etc. GL_COLOR_EXT and friends are only allowed when the default framebuffer is bound, as per spec. Change-Id: Ia8c27038dc899e44d1a95eb88adbc1cac72652b0 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/kernel/qopenglwidget.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp
index a111a72e11..63ef4d6cc6 100644
--- a/src/widgets/kernel/qopenglwidget.cpp
+++ b/src/widgets/kernel/qopenglwidget.cpp
@@ -802,11 +802,11 @@ void QOpenGLWidgetPrivate::invalidateFbo()
{
QOpenGLExtensions *f = static_cast<QOpenGLExtensions *>(QOpenGLContext::currentContext()->functions());
if (f->hasOpenGLExtension(QOpenGLExtensions::DiscardFramebuffer)) {
- const int gl_color_ext = 0x1800;
- const int gl_depth_ext = 0x1801;
- const int gl_stencil_ext = 0x1802;
+ const int gl_color_attachment0 = 0x8CE0; // GL_COLOR_ATTACHMENT0
+ const int gl_depth_attachment = 0x8D00; // GL_DEPTH_ATTACHMENT
+ const int gl_stencil_attachment = 0x8D20; // GL_STENCIL_ATTACHMENT
const GLenum attachments[] = {
- gl_color_ext, gl_depth_ext, gl_stencil_ext
+ gl_color_attachment0, gl_depth_attachment, gl_stencil_attachment
};
f->glDiscardFramebufferEXT(GL_FRAMEBUFFER, sizeof attachments / sizeof *attachments, attachments);
} else {