summaryrefslogtreecommitdiff
path: root/src/mbgl/util/offscreen_texture.hpp
blob: c26570055520a89d54c13a023c2c53464fe34224 (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
#pragma once

#include <mbgl/map/view.hpp>
#include <mbgl/util/image.hpp>

namespace mbgl {

namespace gl {
class Context;
class Texture;
} // namespace gl

enum class OffscreenTextureAttachment {
    None,
    Depth,
};

class OffscreenTexture : public View {
public:
    OffscreenTexture(gl::Context&,
                     Size size = { 256, 256 },
                     OffscreenTextureAttachment type = OffscreenTextureAttachment::None);
    ~OffscreenTexture() override;
    OffscreenTexture(OffscreenTexture&&);
    OffscreenTexture& operator=(OffscreenTexture&&);

    void bind() override;

    PremultipliedImage readStillImage();

    gl::Texture& getTexture();

    const Size& getSize() const;

private:
    class Impl;
    std::unique_ptr<Impl> impl;
};

} // namespace mbgl