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

#include <mbgl/map/view.hpp>
#include <mbgl/gl/framebuffer.hpp>
#include <mbgl/gl/texture.hpp>
#include <mbgl/util/optional.hpp>
#include <mbgl/util/image.hpp>

namespace mbgl {

namespace gl {
class Context;
} // namespace gl

class OffscreenTexture : public View {
public:
    OffscreenTexture(gl::Context&, Size size = { 256, 256 });

    void bind() override;

    PremultipliedImage readStillImage();

    gl::Texture& getTexture();

public:
    const Size size;

private:
    gl::Context& context;
    optional<gl::Framebuffer> framebuffer;
    optional<gl::Texture> texture;
};

} // namespace mbgl