blob: 917741f5cef6b53728d374dce19c7d1411bcc991 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#include "qmapboxgl_renderer_backend.hpp"
#include <QtGlobal>
#if QT_VERSION >= 0x050000
#include <QOpenGLContext>
#else
#include <QGLContext>
#endif
void QMapboxGLRendererBackend::updateAssumedState()
{
assumeFramebufferBinding(ImplicitFramebufferBinding);
assumeViewport(0, 0, m_size);
}
void QMapboxGLRendererBackend::bind()
{
assert(mbgl::BackendScope::exists());
setFramebufferBinding(m_fbo);
setViewport(0, 0, m_size);
}
mbgl::Size QMapboxGLRendererBackend::getFramebufferSize() const
{
return m_size;
}
void QMapboxGLRendererBackend::updateFramebuffer(quint32 fbo, const mbgl::Size &size)
{
m_fbo = fbo;
m_size = size;
}
/*!
Initializes an OpenGL extension function such as Vertex Array Objects (VAOs),
required by Mapbox GL Native engine.
*/
mbgl::gl::ProcAddress QMapboxGLRendererBackend::getExtensionFunctionPointer(const char* name)
{
#if QT_VERSION >= 0x050000
QOpenGLContext* thisContext = QOpenGLContext::currentContext();
return thisContext->getProcAddress(name);
#else
const QGLContext* thisContext = QGLContext::currentContext();
return reinterpret_cast<mbgl::gl::ProcAddress>(thisContext->getProcAddress(name));
#endif
}
|