Mercurial > hg > orthanc-stone
diff Samples/Qt/QStoneOpenGlWidget.h @ 849:8a8cf2991538 am-dev
Qt sample (work in progress)
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Mon, 17 Jun 2019 15:04:47 +0200 |
parents | |
children | 23701fbf228e |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Samples/Qt/QStoneOpenGlWidget.h Mon Jun 17 15:04:47 2019 +0200 @@ -0,0 +1,45 @@ +#pragma once +#include "../../Framework/OpenGL/OpenGLIncludes.h" +#include <QOpenGLWidget> +#include <QOpenGLFunctions> + +#include <boost/shared_ptr.hpp> +#include "../../Framework/OpenGL/IOpenGLContext.h" +#include "../../Framework/Scene2D/OpenGLCompositor.h" + + +class QStoneOpenGlWidget : public QOpenGLWidget, public OrthancStone::OpenGL::IOpenGLContext +{ + boost::shared_ptr<OrthancStone::OpenGLCompositor> compositor_; + +public: + QStoneOpenGlWidget(QWidget *parent) : QOpenGLWidget(parent) { } + +protected: + void initializeGL() override; + + void resizeGL(int w, int h) override; + + void paintGL() override; + + virtual void MakeCurrent() override {} + + virtual void SwapBuffer() override {} + + virtual unsigned int GetCanvasWidth() const override + { + return this->width(); + } + + virtual unsigned int GetCanvasHeight() const override + { + return this->height(); + } + +public: + void SetCompositor(boost::shared_ptr<OrthancStone::OpenGLCompositor> compositor) + { + compositor_ = compositor; + } + +};