Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'qt/qtoglcontext.hpp')
-rw-r--r--qt/qtoglcontext.hpp45
1 files changed, 40 insertions, 5 deletions
diff --git a/qt/qtoglcontext.hpp b/qt/qtoglcontext.hpp
index 2bc7000de3..feaaee10c6 100644
--- a/qt/qtoglcontext.hpp
+++ b/qt/qtoglcontext.hpp
@@ -2,14 +2,50 @@
#include "drape/oglcontext.hpp"
+#include "std/function.hpp"
+#include "std/atomic.hpp"
+
#include <QtGui/QWindow>
#include <QtGui/QOpenGLContext>
-class QtOGLContext: public dp::OGLContext
+#include <QtCore/QThread>
+
+class QtRenderOGLContext : public dp::OGLContext
+{
+public:
+ using TRegisterThreadFn = function<void (QThread * thread)>;
+ using TSwapFn = function<void ()>;
+
+ QtRenderOGLContext(QOpenGLContext * nativeContext, QThread * guiThread,
+ TRegisterThreadFn const & regFn, TSwapFn const & swapFn);
+
+ void present() override;
+ void makeCurrent() override;
+ void doneCurrent() override;
+ void setDefaultFramebuffer() override;
+
+ void shutDown();
+
+ QOpenGLContext * getNativeContext() { return m_ctx; }
+
+private:
+ void MoveContextOnGui();
+
+private:
+ QSurface * m_surface;
+ QOpenGLContext * m_ctx;
+ QThread * m_guiThread;
+ TRegisterThreadFn m_regFn;
+ TSwapFn m_swapFn;
+ bool m_isRegistered;
+ atomic<bool> m_shutedDown;
+};
+
+class QtUploadOGLContext: public dp::OGLContext
{
public:
- QtOGLContext(QWindow * surface, QtOGLContext * contextToShareWith);
- ~QtOGLContext();
+ QtUploadOGLContext(QSurface * surface, QOpenGLContext * contextToShareWith);
+ ~QtUploadOGLContext();
virtual void present();
virtual void makeCurrent();
@@ -17,6 +53,5 @@ public:
private:
QOpenGLContext * m_nativeContext;
- QWindow * m_surface;
- bool m_isContextCreated;
+ QSurface * m_surface;
};