equal
deleted
inserted
replaced
996 |
996 |
997 // No multisample with combined depth/stencil attachment: |
997 // No multisample with combined depth/stencil attachment: |
998 QGLFramebufferObjectFormat fboFormat; |
998 QGLFramebufferObjectFormat fboFormat; |
999 fboFormat.setAttachment(QGLFramebufferObject::NoAttachment); |
999 fboFormat.setAttachment(QGLFramebufferObject::NoAttachment); |
1000 |
1000 |
1001 // Don't complicate things by using NPOT: |
1001 QGLFramebufferObject *fbo = new QGLFramebufferObject(200, 100, fboFormat); |
1002 QGLFramebufferObject *fbo = new QGLFramebufferObject(256, 128, fboFormat); |
|
1003 |
1002 |
1004 fbo->bind(); |
1003 fbo->bind(); |
1005 |
1004 |
1006 glClearColor(1.0, 0.0, 0.0, 1.0); |
1005 glClearColor(1.0, 0.0, 0.0, 1.0); |
1007 glClear(GL_COLOR_BUFFER_BIT); |
1006 glClear(GL_COLOR_BUFFER_BIT); |
1033 QGLFramebufferObjectFormat fboFormat; |
1032 QGLFramebufferObjectFormat fboFormat; |
1034 fboFormat.setAttachment(QGLFramebufferObject::CombinedDepthStencil); |
1033 fboFormat.setAttachment(QGLFramebufferObject::CombinedDepthStencil); |
1035 |
1034 |
1036 // Don't complicate things by using NPOT: |
1035 // Don't complicate things by using NPOT: |
1037 QGLFramebufferObject *fbo = new QGLFramebufferObject(256, 128, fboFormat); |
1036 QGLFramebufferObject *fbo = new QGLFramebufferObject(256, 128, fboFormat); |
|
1037 |
|
1038 if (fbo->attachment() != QGLFramebufferObject::CombinedDepthStencil) { |
|
1039 delete fbo; |
|
1040 QSKIP("FBOs missing combined depth~stencil support", SkipSingle); |
|
1041 } |
1038 |
1042 |
1039 QPainter fboPainter; |
1043 QPainter fboPainter; |
1040 bool painterBegun = fboPainter.begin(fbo); |
1044 bool painterBegun = fboPainter.begin(fbo); |
1041 QVERIFY(painterBegun); |
1045 QVERIFY(painterBegun); |
1042 |
1046 |
1095 fboFormat.setAttachment(QGLFramebufferObject::CombinedDepthStencil); |
1099 fboFormat.setAttachment(QGLFramebufferObject::CombinedDepthStencil); |
1096 |
1100 |
1097 QGLFramebufferObject *fbo1 = new QGLFramebufferObject(256, 128, fboFormat); |
1101 QGLFramebufferObject *fbo1 = new QGLFramebufferObject(256, 128, fboFormat); |
1098 QGLFramebufferObject *fbo2 = new QGLFramebufferObject(256, 128, fboFormat); |
1102 QGLFramebufferObject *fbo2 = new QGLFramebufferObject(256, 128, fboFormat); |
1099 QGLFramebufferObject *fbo3 = new QGLFramebufferObject(256, 128, fboFormat); |
1103 QGLFramebufferObject *fbo3 = new QGLFramebufferObject(256, 128, fboFormat); |
|
1104 |
|
1105 if ( (fbo1->attachment() != QGLFramebufferObject::CombinedDepthStencil) || |
|
1106 (fbo2->attachment() != QGLFramebufferObject::CombinedDepthStencil) || |
|
1107 (fbo3->attachment() != QGLFramebufferObject::CombinedDepthStencil) ) |
|
1108 { |
|
1109 delete fbo1; |
|
1110 delete fbo2; |
|
1111 delete fbo3; |
|
1112 QSKIP("FBOs missing combined depth~stencil support", SkipSingle); |
|
1113 } |
1100 |
1114 |
1101 QPainter fbo1Painter; |
1115 QPainter fbo1Painter; |
1102 QPainter fbo2Painter; |
1116 QPainter fbo2Painter; |
1103 QPainter fbo3Painter; |
1117 QPainter fbo3Painter; |
1104 |
1118 |
1201 void paintEvent(QPaintEvent*) |
1215 void paintEvent(QPaintEvent*) |
1202 { |
1216 { |
1203 QPainter widgetPainter; |
1217 QPainter widgetPainter; |
1204 widgetPainterBeginOk = widgetPainter.begin(this); |
1218 widgetPainterBeginOk = widgetPainter.begin(this); |
1205 QGLFramebufferObjectFormat fboFormat; |
1219 QGLFramebufferObjectFormat fboFormat; |
1206 fboFormat.setAttachment(QGLFramebufferObject::CombinedDepthStencil); |
1220 fboFormat.setAttachment(QGLFramebufferObject::NoAttachment); |
1207 QGLFramebufferObject *fbo = new QGLFramebufferObject(128, 128, fboFormat); |
1221 QGLFramebufferObject *fbo = new QGLFramebufferObject(100, 100, fboFormat); |
1208 |
1222 |
1209 QPainter fboPainter; |
1223 QPainter fboPainter; |
1210 fboPainterBeginOk = fboPainter.begin(fbo); |
1224 fboPainterBeginOk = fboPainter.begin(fbo); |
1211 fboPainter.fillRect(-1, -1, 130, 130, Qt::red); |
1225 fboPainter.fillRect(-1, -1, 130, 130, Qt::red); |
1212 fboPainter.end(); |
1226 fboPainter.end(); |
1226 |
1240 |
1227 FBOUseInGLWidget w; |
1241 FBOUseInGLWidget w; |
1228 #ifdef Q_WS_QWS |
1242 #ifdef Q_WS_QWS |
1229 w.setWindowFlags(Qt::FramelessWindowHint); |
1243 w.setWindowFlags(Qt::FramelessWindowHint); |
1230 #endif |
1244 #endif |
1231 w.resize(128, 128); |
1245 w.resize(100, 100); |
1232 w.show(); |
1246 w.show(); |
1233 |
1247 |
1234 #ifdef Q_WS_X11 |
1248 #ifdef Q_WS_X11 |
1235 qt_x11_wait_for_window_manager(&w); |
1249 qt_x11_wait_for_window_manager(&w); |
1236 #endif |
1250 #endif |
1337 delete w; |
1351 delete w; |
1338 |
1352 |
1339 QImage fb = pm.toImage().convertToFormat(QImage::Format_RGB32); |
1353 QImage fb = pm.toImage().convertToFormat(QImage::Format_RGB32); |
1340 QImage reference(fb.size(), QImage::Format_RGB32); |
1354 QImage reference(fb.size(), QImage::Format_RGB32); |
1341 reference.fill(0xffff0000); |
1355 reference.fill(0xffff0000); |
|
1356 |
|
1357 #ifdef QGL_EGL |
|
1358 QSKIP("renderPixmap() not yet supported under EGL", SkipAll); |
|
1359 #endif |
1342 |
1360 |
1343 QFUZZY_COMPARE_IMAGES(fb, reference); |
1361 QFUZZY_COMPARE_IMAGES(fb, reference); |
1344 } |
1362 } |
1345 |
1363 |
1346 class ColormapExtended : public QGLColormap |
1364 class ColormapExtended : public QGLColormap |