Enable the depth and stencil buffers by default in QOpenGLWidget

QGLWidget rendered to the default framebuffer, which had a depth and
stencil buffer attached by default.

Keep this behavior by adding the attachments to the FBO by default
in QOpenGLWidget.

Change-Id: I6f72a444eac3d8eabb7a539ad12216f1e5d2183d
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
This commit is contained in:
Jocelyn Turcotte 2014-03-28 12:32:54 +01:00 committed by The Qt Project
parent ee3dea8d3f
commit 7672f25f44

View File

@ -163,7 +163,7 @@ void QOpenGLWidget::resizeEvent(QResizeEvent *)
d->context.makeCurrent(d->surface());
delete d->fbo; // recreate when resized
d->fbo = new QOpenGLFramebufferObject(size() * devicePixelRatio());
d->fbo = new QOpenGLFramebufferObject(size() * devicePixelRatio(), QOpenGLFramebufferObject::CombinedDepthStencil);
d->fbo->bind();
QOpenGLFunctions *funcs = d->context.functions();
funcs->glBindTexture(GL_TEXTURE_2D, d->fbo->texture());