Files
comaps/qt/qt_common/qtoglcontextfactory.hpp
Konstantin Pastbin e3e4a1985a Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
2025-05-08 21:10:51 +07:00

44 lines
1.2 KiB
C++

#pragma once
#include "drape/graphics_context_factory.hpp"
#include "qt/qt_common/qtoglcontext.hpp"
#include <QtGui/QOpenGLContext>
#include <memory>
namespace qt
{
namespace common
{
class QtOGLContextFactory : public dp::GraphicsContextFactory
{
public:
QtOGLContextFactory(QOpenGLContext * rootContext);
~QtOGLContextFactory() override;
void PrepareToShutdown();
bool AcquireFrame();
GLuint GetTextureHandle() const;
QRectF const & GetTexRect() const;
// dp::GraphicsContextFactory overrides:
dp::GraphicsContext * GetDrawContext() override;
dp::GraphicsContext * GetResourcesUploadContext() override;
bool IsDrawContextCreated() const override { return m_drawContext != nullptr; }
bool IsUploadContextCreated() const override { return m_uploadContext != nullptr; }
private:
std::unique_ptr<QOffscreenSurface> CreateSurface();
QOpenGLContext * m_rootContext;
std::unique_ptr<QtRenderOGLContext> m_drawContext;
std::unique_ptr<QOffscreenSurface> m_drawSurface;
std::unique_ptr<QtUploadOGLContext> m_uploadContext;
std::unique_ptr<QOffscreenSurface> m_uploadSurface;
bool m_preparedToShutdown = false;
};
} // namespace common
} // namespace qt