summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgl/tst_qgl.cpp
diff options
context:
space:
mode:
authorTom Cooksey <thomas.cooksey@nokia.com>2009-11-09 07:32:40 (GMT)
committerTom Cooksey <thomas.cooksey@nokia.com>2009-11-09 08:50:35 (GMT)
commit3143014a80d1dfdfe3bb0f6175a3f7f7f41b2aaf (patch)
treee5952789e44e83553cd127339250a764349e3202 /tests/auto/qgl/tst_qgl.cpp
parent09a123c7f9df37f82a4baab0e7ec70ebfe5444d3 (diff)
downloadQt-3143014a80d1dfdfe3bb0f6175a3f7f7f41b2aaf.zip
Qt-3143014a80d1dfdfe3bb0f6175a3f7f7f41b2aaf.tar.gz
Qt-3143014a80d1dfdfe3bb0f6175a3f7f7f41b2aaf.tar.bz2
Add a simpler FBO autotest which just uses glClear()
If this autotest doesn't pass, FBOs are really broken.
Diffstat (limited to 'tests/auto/qgl/tst_qgl.cpp')
-rw-r--r--tests/auto/qgl/tst_qgl.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp
index 373cc45..ccb08c3 100644
--- a/tests/auto/qgl/tst_qgl.cpp
+++ b/tests/auto/qgl/tst_qgl.cpp
@@ -76,6 +76,7 @@ private slots:
void partialGLWidgetUpdates_data();
void partialGLWidgetUpdates();
void glWidgetRendering();
+ void glFBOSimpleRendering();
void glFBORendering();
void multipleFBOInterleavedRendering();
void glFBOUseInGLWidget();
@@ -973,6 +974,36 @@ void tst_QGL::glWidgetRendering()
QFUZZY_COMPARE_IMAGES(fb, reference);
}
+void tst_QGL::glFBOSimpleRendering()
+{
+ if (!QGLFramebufferObject::hasOpenGLFramebufferObjects())
+ QSKIP("QGLFramebufferObject not supported on this platform", SkipSingle);
+
+ QGLWidget glw;
+ glw.makeCurrent();
+
+ // No multisample with combined depth/stencil attachment:
+ QGLFramebufferObjectFormat fboFormat;
+ fboFormat.setAttachment(QGLFramebufferObject::NoAttachment);
+
+ // Don't complicate things by using NPOT:
+ QGLFramebufferObject *fbo = new QGLFramebufferObject(256, 128, fboFormat);
+
+ fbo->bind();
+
+ glClearColor(1.0, 0.0, 0.0, 1.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+ glFinish();
+
+ QImage fb = fbo->toImage().convertToFormat(QImage::Format_RGB32);
+ QImage reference(fb.size(), QImage::Format_RGB32);
+ reference.fill(0xffff0000);
+
+ QFUZZY_COMPARE_IMAGES(fb, reference);
+
+ delete fbo;
+}
+
// NOTE: This tests that CombinedDepthStencil attachment works by assuming the
// GL2 engine is being used and is implemented the same way as it was when
// this autotest was written. If this is not the case, there may be some