Slide 1

Slide 1 text

Graphics on Raspberry Pi with Qt 5

Slide 2

Slide 2 text

Agenda • OpenGL and Gt • Cross-compiling Qt 5.6 • Next generation 3D rendering

Slide 3

Slide 3 text

Me • Call me TP • Follow @uranusjr • https://uranusjr.com

Slide 4

Slide 4 text

www. .com

Slide 5

Slide 5 text

Why Qt? • OpenGL is tedious • Long history of integration • Qt Quick and QML • Continuous improvements

Slide 6

Slide 6 text

#include #include int main(int argc, char *argv[]) { QApplication app(argc, argv); QWidget w; w.show(); return app.exec(); }

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

How? • Widgets • Put things inside a widget • Put widgets in a window • Show windows in an application

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

C++ Classes • QOpenGLWidget • QOpenGLContext • QOpenGLFunctions

Slide 12

Slide 12 text

#include 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(); }

Slide 13

Slide 13 text

/usr/lib/x86_64-linux-gnu/qt5/examples/gui/openglwindow/

Slide 14

Slide 14 text

Read the docs. http://doc.qt.io/qt-5/qopenglwidget.html

Slide 15

Slide 15 text

Problems? • Legacy QtOpenGL module • Raspbian updates slowly • We want newer Qt

Slide 16

Slide 16 text

Cross-Compiling • More up-to-date Qt distribution • Better support for add-on modules • Advanced tuning (if you want to)

Slide 17

Slide 17 text

Read the wiki. https://wiki.qt.io/RaspberryPi_Beginners_Guide

Slide 18

Slide 18 text

Read my notes. http://bit.ly/rpi-qt5-cross-compile

Slide 19

Slide 19 text

Demo

Slide 20

Slide 20 text

Qt 3D • Based on OpenGL • Simple C++ or QML usage • Quite powerful

Slide 21

Slide 21 text

Qt 3D Canvas • Based on OpenGL • JavaScript API in Qt Quick • Modelled from WebGL • three.js port!