main.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #include <QtGui/QApplication>
  2. #include <QtOpenGL>
  3. #include <qdeclarative.h>
  4. #include "qmlapplicationviewer.h"
  5. #include "qparticles.h"
  6. Q_DECL_EXPORT int main(int argc, char *argv[])
  7. {
  8. // Depending on which is the recommended way for the platform, either use
  9. // opengl graphics system or paint into QGLWidget.
  10. //#ifdef SHADEREFFECTS_USE_OPENGL_GRAPHICSSYSTEM
  11. // QApplication::setGraphicsSystem("opengl");
  12. //#endif
  13. QScopedPointer<QApplication> app(createApplication(argc, argv));
  14. qmlRegisterType<QParticles>("Particles", 1, 0, "Particles");
  15. QmlApplicationViewer viewer;
  16. //#ifndef SHADEREFFECTS_USE_OPENGL_GRAPHICSSYSTEM
  17. QGLFormat format = QGLFormat::defaultFormat();
  18. format.setSampleBuffers(false);
  19. // format.setSwapInterval(1);
  20. QGLWidget* glWidget = new QGLWidget(format);
  21. glWidget->setAutoFillBackground(false);
  22. viewer.setViewport(glWidget);
  23. //#endif
  24. // viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait);
  25. // viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape);
  26. viewer.setMainQmlFile(QLatin1String("qml/sparticles/main.qml"));
  27. viewer.showExpanded();
  28. return app->exec();
  29. }