summaryrefslogtreecommitdiff
path: root/src/mbgl/gfx
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2019-04-01 13:48:20 +0200
committerKonstantin Käfer <mail@kkaefer.com>2019-04-05 11:49:17 +0200
commit865f8a6c03540e329ed6caef354799fb58b7ab6e (patch)
tree8c748a0ef16dc88ed0ceeadea71f20bfd99cdf96 /src/mbgl/gfx
parentebd850803278a6ffbca0bc8a5b96d415b239aeb8 (diff)
downloadqtlocation-mapboxgl-865f8a6c03540e329ed6caef354799fb58b7ab6e.tar.gz
[core] add gfx::Renderable and gfx::OffscreenTexture
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