summaryrefslogtreecommitdiff
path: root/include/mbgl/platform/default/offscreen_view.hpp
blob: 0e839e14cc8d592b0b9143c0a0f99a9f7b6c2960 (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
#pragma once

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

namespace mbgl {

namespace gl {
class Context;
} // namespace gl

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

    void bind() override;

    PremultipliedImage readStillImage();

public:
    const Size size;

private:
    gl::Context& context;
    optional<gl::Framebuffer> framebuffer;
    optional<gl::Renderbuffer<gl::RenderbufferType::RGBA>> color;
    optional<gl::Renderbuffer<gl::RenderbufferType::DepthStencil>> depthStencil;
};

} // namespace mbgl