summaryrefslogtreecommitdiff
path: root/src/mbgl/gfx
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/gfx')
-rw-r--r--src/mbgl/gfx/context.hpp10
-rw-r--r--src/mbgl/gfx/offscreen_texture.hpp25
2 files changed, 35 insertions, 0 deletions
diff --git a/src/mbgl/gfx/context.hpp b/src/mbgl/gfx/context.hpp
index 1ce00f04d1..c956debcb0 100644
--- a/src/mbgl/gfx/context.hpp
+++ b/src/mbgl/gfx/context.hpp
@@ -17,6 +17,8 @@ class ProgramParameters;
namespace gfx {
+class OffscreenTexture;
+
class Context {
protected:
Context(ContextType type_, uint32_t maximumVertexBindingCount_)
@@ -124,6 +126,14 @@ protected:
TexturePixelType, TextureChannelDataType) = 0;
public:
+ virtual std::unique_ptr<gfx::OffscreenTexture> createOffscreenTexture(
+ Size, gfx::TextureChannelDataType = gfx::TextureChannelDataType::UnsignedByte) = 0;
+ virtual std::unique_ptr<gfx::OffscreenTexture> createOffscreenTexture(
+ Size,
+ gfx::Renderbuffer<gfx::RenderbufferPixelType::Depth>&,
+ gfx::TextureChannelDataType = gfx::TextureChannelDataType::UnsignedByte) = 0;
+
+public:
template <RenderbufferPixelType pixelType>
Renderbuffer<pixelType>
createRenderbuffer(const Size size) {
diff --git a/src/mbgl/gfx/offscreen_texture.hpp b/src/mbgl/gfx/offscreen_texture.hpp
new file mode 100644
index 0000000000..1eaf4557c6
--- /dev/null
+++ b/src/mbgl/gfx/offscreen_texture.hpp
@@ -0,0 +1,25 @@
+#pragma once
+
+#include <mbgl/gfx/renderable.hpp>
+#include <mbgl/util/image.hpp>
+
+namespace mbgl {
+namespace gfx {
+
+class Texture;
+
+class OffscreenTexture : public gfx::Renderable {
+protected:
+ OffscreenTexture(const Size size_, std::unique_ptr<RenderableResource> resource_)
+ : gfx::Renderable(size_, std::move(resource_)) {
+ }
+
+public:
+ virtual ~OffscreenTexture() = default;
+
+ virtual PremultipliedImage readStillImage() = 0;
+ virtual gfx::Texture& getTexture() = 0;
+};
+
+} // namespace gfx
+} // namespace mbgl