Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Graphics on Raspberry Pi with Qt 5

Graphics on Raspberry Pi with Qt 5

Given at Raspberry Pi Community meetup #14 at CLBC.
http://raspberrypi-tw-bdfa45.kktix.cc/events/meetup14

* Integrating OpenGL code into Qt 5 with the new QOpenGL* classes.
* Cross-compiling Qt for Raspbian, where those new classes are not generally available.[*]
* Next-generation support libraries Qt 3D and Qt 3D Canvas (not related with each other) coming with Qt 5.7.

[*]: You might also be interested in my cross-compiling notes.
https://gist.github.com/uranusjr/91c0086109e6c35bbbe48a0b6a405f78

Tzu-ping Chung

June 27, 2016
Tweet

More Decks by Tzu-ping Chung

Other Decks in Programming

Transcript

  1. Why Qt? • OpenGL is tedious • Long history of

    integration • Qt Quick and QML • Continuous improvements
  2. #include <QApplication> #include <QWidget> int main(int argc, char *argv[]) {

    QApplication app(argc, argv); QWidget w; w.show(); return app.exec(); }
  3. How? • Widgets • Put things inside a widget •

    Put widgets in a window • Show windows in an application
  4. How? • Widgets • Add common GUI controls • Put

    widgets in a window • Show windows in an application
  5. How? • Widgets • Draw things with OpenGL • Put

    widgets in a window • Show windows in an application
  6. #include <QtWidgets/QOpenGLWidget> class MyWidget : public QOpenGLWidget { protected: //

    One-off settings. virtual void initializeGL(); // Set projection. Called on resizing. virtual void resizeGL(int w, int h); // Do actual OpenGL painting. virtual void paintGL(); }
  7. Cross-Compiling • More up-to-date Qt distribution • Better support for

    add-on modules • Advanced tuning (if you want to)
  8. Qt 3D • Based on OpenGL • Simple C++ or

    QML usage • Quite powerful
  9. Qt 3D Canvas • Based on OpenGL • JavaScript API

    in Qt Quick • Modelled from WebGL • three.js port!