From f6e79d70735361438655f279c8699a786d25458c Mon Sep 17 00:00:00 2001 From: Lauren Budorick Date: Thu, 27 Apr 2017 15:56:55 -0700 Subject: [core] Render fill-extrusion layers (#8431) --- src/mbgl/util/offscreen_texture.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/mbgl/util/offscreen_texture.cpp') diff --git a/src/mbgl/util/offscreen_texture.cpp b/src/mbgl/util/offscreen_texture.cpp index 56ef60b15c..e719ac566e 100644 --- a/src/mbgl/util/offscreen_texture.cpp +++ b/src/mbgl/util/offscreen_texture.cpp @@ -14,12 +14,13 @@ public: void bind() { if (!framebuffer) { - texture = context.createTexture(size); + texture = context.createTexture(size, gl::TextureFormat::RGBA); framebuffer = context.createFramebuffer(*texture); } else { context.bindFramebuffer = framebuffer->framebuffer; } + context.activeTexture = 0; context.viewport = { 0, 0, size }; } @@ -36,6 +37,20 @@ public: return size; } + void bindRenderbuffers(gl::TextureUnit unit) { + if (!framebuffer) { + texture = context.createTexture(size, gl::TextureFormat::RGBA, unit); + gl::Renderbuffer depthTarget = context.createRenderbuffer(size); + framebuffer = context.createFramebuffer(*texture, depthTarget); + + } else { + context.bindFramebuffer = framebuffer->framebuffer; + } + + context.activeTexture = unit; + context.viewport = { 0, 0, size }; + } + private: gl::Context& context; const Size size; @@ -66,4 +81,8 @@ const Size& OffscreenTexture::getSize() const { return impl->getSize(); } +void OffscreenTexture::bindRenderbuffers(gl::TextureUnit unit) { + impl->bindRenderbuffers(unit); +} + } // namespace mbgl -- cgit v1.2.1