From 24742e54332a71db0bc5ae7b1632924ae592aea7 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Mon, 9 Aug 2010 13:39:51 +0200 Subject: OpenGL: Fix multisample renderbuffer creation when MAX_SAMPLES is 0. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, we would try to create one with samples = 1 anyway, potentially resulting in an INVALID_VALUE error. Task-number: QTBUG-12757 Reviewed-by: Samuel Rødal --- src/opengl/qglframebufferobject.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index deffc20..9b8a3d1 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -445,11 +445,11 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, GLint maxSamples; glGetIntegerv(GL_MAX_SAMPLES_EXT, &maxSamples); - samples = qBound(1, int(samples), int(maxSamples)); + samples = qBound(0, int(samples), int(maxSamples)); glGenRenderbuffers(1, &color_buffer); glBindRenderbuffer(GL_RENDERBUFFER_EXT, color_buffer); - if (glRenderbufferStorageMultisampleEXT) { + if (glRenderbufferStorageMultisampleEXT && samples > 0) { glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, samples, internal_format, size.width(), size.height()); } else { -- cgit v0.12