diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2016-10-06 13:23:50 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2016-10-25 13:52:36 -0700 |
commit | 5cc390d694fc7510d445310d8eb9e32429a5e67b (patch) | |
tree | 7a24706f919ac3e8154be8b4ce33aed5bf42188d /test/util/offscreen_texture.test.cpp | |
parent | 45f4dc0166f2d609d014d2174209fdbe1994c943 (diff) | |
download | qtlocation-mapboxgl-5cc390d694fc7510d445310d8eb9e32429a5e67b.tar.gz |
[core] separate Backend from View for headless rendering
Diffstat (limited to 'test/util/offscreen_texture.test.cpp')
-rw-r--r-- | test/util/offscreen_texture.test.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/test/util/offscreen_texture.test.cpp b/test/util/offscreen_texture.test.cpp index 301fc2c250..e281a3d65b 100644 --- a/test/util/offscreen_texture.test.cpp +++ b/test/util/offscreen_texture.test.cpp @@ -1,15 +1,18 @@ #include <mbgl/test/util.hpp> #include <mbgl/gl/context.hpp> +#include <mbgl/platform/default/headless_backend.hpp> #include <mbgl/platform/default/headless_view.hpp> +#include <mbgl/gl/gl.hpp> #include <mbgl/util/offscreen_texture.hpp> using namespace mbgl; TEST(OffscreenTexture, EmptyRed) { + HeadlessBackend backend; HeadlessView view(1.0f, 512, 256); - view.activate(); + view.bind(); MBGL_CHECK_ERROR(glClearColor(1.0f, 0.0f, 0.0f, 1.0f)); MBGL_CHECK_ERROR(glClear(GL_COLOR_BUFFER_BIT)); @@ -64,11 +67,11 @@ struct Buffer { TEST(OffscreenTexture, RenderToTexture) { + HeadlessBackend backend; HeadlessView view(1.0f, 512, 256); - view.activate(); + view.bind(); gl::Context context; context.viewport.setDefaultValue(gl::value::Viewport::Get()); - context.bindFramebuffer.setDefaultValue(gl::value::BindFramebuffer::Get()); MBGL_CHECK_ERROR(glEnable(GL_BLEND)); MBGL_CHECK_ERROR(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); @@ -130,6 +133,8 @@ void main() { // Now reset the FBO back to normal and retrieve the original (restored) framebuffer. context.resetState(); + context.bindFramebuffer.setDirty(); + view.bind(); image = view.readStillImage(); test::checkImage("test/fixtures/offscreen_texture/render-to-fbo", image, 0, 0); |