summaryrefslogtreecommitdiff
path: root/platform/ios/src/MGLMapView+OpenGL.h
blob: 12edb13113976af3b576f36728ad369c7c4cab5b (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
50
51
52
53
54
55
56
57
58
59
#import "MGLMapView+Impl.h"
#import "MGLMapView_Private.h"

#include <mbgl/gfx/renderable.hpp>
#include <mbgl/gl/renderer_backend.hpp>

@class MGLMapViewImplDelegate;

/// Adapter responsible for bridging calls from mbgl to MGLMapView and Cocoa.
class MGLMapViewOpenGLImpl final : public MGLMapViewImpl,
                                   public mbgl::gl::RendererBackend,
                                   public mbgl::gfx::Renderable {
public:
    MGLMapViewOpenGLImpl(MGLMapView*);
    ~MGLMapViewOpenGLImpl() override;

public:
    void restoreFramebufferBinding();

#ifdef MGL_RECREATE_GL_IN_AN_EMERGENCY
private:
    void emergencyRecreateGL();
#endif

    // Implementation of mbgl::gfx::RendererBackend
public:
    mbgl::gfx::Renderable& getDefaultRenderable() override {
        return *this;
    }

private:
    void activate() override;
    void deactivate() override;
    // End implementation of mbgl::gfx::RendererBackend

    // Implementation of mbgl::gl::RendererBackend
public:
    void updateAssumedState() override;

private:
    mbgl::gl::ProcAddress getExtensionFunctionPointer(const char* name) override;
    // End implementation of mbgl::gl::Rendererbackend

    // Implementation of MGLMapViewImpl
public:
    mbgl::gfx::RendererBackend& getRendererBackend() override {
        return *this;
    }

    EAGLContext* getEAGLContext() override;
    void setOpaque(bool) override;
    void display() override;
    void setPresentsWithTransaction(bool) override;
    void createView() override;
    UIView* getView() override;
    void deleteView() override;
    UIImage* snapshot() override;
    // End implementation of MGLMapViewImpl
};