January 2019
Intermediate to advanced
384 pages
11h 50m
English
The QQuickFramebufferObject allows us to wrap custom OpenGL code in a QML item. The rendering gets redirected off screen to an OpenGL frame buffer object and Qt creates the required scene graph object to accomplish that. The following example shows the basic usage:
class FrameBufferTriangle : public QQuickFramebufferObject{public: Renderer* createRenderer() const override; ...};class FrameBufferTriangleRenderer : public QQuickFramebufferObject::Renderer{public: void synchronize(QQuickFramebufferObject *item) override; QOpenGLFramebufferObject *createFramebufferObject(const QSize &s) override; void render() override { QOpenGLFunctions* f = QOpenGLContext::currentContext()->functions(); // use OpenGL functions f->glClearColor(1,1,1,0); ...Read now
Unlock full access