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:
authorExMix <rahuba.youri@mapswithme.com>2014-11-18 10:59:23 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:32:49 +0300
commit9e3bab30ae6a1f87af82a2fdc9502fbaa98a3351 (patch)
tree4848e79331a768c1066fd71c5527ef17f55e28bc /qt/qtoglcontext.cpp
parentc7e4429a42b5592603b4ea6c03f7373e23ad5fdf (diff)
[desktop] surface and OGL for desktop build with drape renderer
Diffstat (limited to 'qt/qtoglcontext.cpp')
-rw-r--r--qt/qtoglcontext.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/qt/qtoglcontext.cpp b/qt/qtoglcontext.cpp
new file mode 100644
index 0000000000..feee116dc1
--- /dev/null
+++ b/qt/qtoglcontext.cpp
@@ -0,0 +1,49 @@
+#include "qtoglcontext.hpp"
+
+#include "../base/assert.hpp"
+#include "../base/logging.hpp"
+
+#include "../drape/glfunctions.hpp"
+
+QtOGLContext::QtOGLContext(QWindow * surface, QtOGLContext * contextToShareWith)
+{
+ m_isContextCreated = false;
+ m_surface = surface;
+ m_nativeContext = new QOpenGLContext();
+
+ if (contextToShareWith != NULL)
+ m_nativeContext->setShareContext(contextToShareWith->m_nativeContext);
+
+ m_nativeContext->setFormat(m_surface->requestedFormat());
+ ASSERT(m_surface->isExposed(), ());
+ VERIFY(m_nativeContext->create(), ());
+}
+
+QtOGLContext::~QtOGLContext()
+{
+ delete m_nativeContext;
+}
+
+void QtOGLContext::makeCurrent()
+{
+ ASSERT(m_nativeContext->isValid(), ());
+ m_nativeContext->makeCurrent(m_surface);
+
+#ifdef DEBUG
+ LOG(LDEBUG, ("Current context : ", m_nativeContext));
+ QList<QOpenGLContext *> list = QOpenGLContextGroup::currentContextGroup()->shares();
+ for (int i = 0; i < list.size(); ++i)
+ LOG(LDEBUG, ("Share context : ", list[i]));
+#endif
+}
+
+void QtOGLContext::present()
+{
+ m_nativeContext->makeCurrent(m_surface);
+ m_nativeContext->swapBuffers(m_surface);
+}
+
+void QtOGLContext::setDefaultFramebuffer()
+{
+ GLFunctions::glBindFramebuffer(GL_FRAMEBUFFER, 0);
+}