Files
MapLibreParticleLab/platform/qt/src/headless_backend_qt.cpp
Thiago Marcos P. Santos cd92a231b3 [qt] Deprecate Qt4 and old versions of Qt5
Not enough adoption to keep the platform alive.
2018-11-13 22:55:26 +02:00

37 lines
736 B
C++

#include <mbgl/gl/headless_backend.hpp>
#include <QGLWidget>
#include <QOpenGLContext>
#include <cassert>
namespace mbgl {
class QtBackendImpl : public HeadlessBackend::Impl {
public:
~QtBackendImpl() final = default;
gl::ProcAddress getExtensionFunctionPointer(const char* name) final {
QOpenGLContext* thisContext = QOpenGLContext::currentContext();
return thisContext->getProcAddress(name);
}
void activateContext() final {
widget.makeCurrent();
}
void deactivateContext() final {
widget.doneCurrent();
}
private:
QGLWidget widget;
};
void HeadlessBackend::createImpl() {
assert(!impl);
impl = std::make_unique<QtBackendImpl>();
}
} // namespace mbgl