diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-09-26 12:53:32 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-10-28 17:14:01 -0700 |
commit | 0e57d10d77e555a9229f7d522d83f87df7d5180d (patch) | |
tree | 2a3c3b0dd4ed6edf385ba8d390d919e469b7a96a /test/util | |
parent | a4c82b8a3b5e48f3bbccf32be80d45ca78d51515 (diff) | |
download | qtlocation-mapboxgl-0e57d10d77e555a9229f7d522d83f87df7d5180d.tar.gz |
[core] Modern C++ bindings for OpenGL
Diffstat (limited to 'test/util')
-rw-r--r-- | test/util/offscreen_texture.test.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/test/util/offscreen_texture.test.cpp b/test/util/offscreen_texture.test.cpp index a1e444ed65..56972b9810 100644 --- a/test/util/offscreen_texture.test.cpp +++ b/test/util/offscreen_texture.test.cpp @@ -107,21 +107,19 @@ void main() { // Make sure the texture gets destructed before we call context.reset(); { OffscreenView view(context, { 512, 256 }); + view.bind(); // First, draw red to the bound FBO. - context.clearColor = { 1, 0, 0, 1 }; - view.bind(); - MBGL_CHECK_ERROR(glClear(GL_COLOR_BUFFER_BIT)); + context.clear(Color::red(), {}, {}); // Then, create a texture, bind it, and render yellow to that texture. This should not // affect the originally bound FBO. OffscreenTexture texture(context, { 128, 128 }); texture.bind(); - context.clearColor = { 0, 0, 0, 0 }; - MBGL_CHECK_ERROR(glClear(GL_COLOR_BUFFER_BIT)); + context.clear(Color(), {}, {}); - context.program = paintShader.program; + MBGL_CHECK_ERROR(glUseProgram(paintShader.program)); MBGL_CHECK_ERROR(glBindBuffer(GL_ARRAY_BUFFER, triangleBuffer.buffer)); MBGL_CHECK_ERROR(glEnableVertexAttribArray(paintShader.a_pos)); MBGL_CHECK_ERROR( @@ -138,8 +136,8 @@ void main() { test::checkImage("test/fixtures/offscreen_texture/render-to-fbo", image, 0, 0); // Now, composite the Framebuffer texture we've rendered to onto the main FBO. - context.program = compositeShader.program; context.bindTexture(texture.getTexture(), 0, gl::TextureFilter::Linear); + MBGL_CHECK_ERROR(glUseProgram(compositeShader.program)); MBGL_CHECK_ERROR(glUniform1i(u_texture, 0)); MBGL_CHECK_ERROR(glBindBuffer(GL_ARRAY_BUFFER, viewportBuffer.buffer)); MBGL_CHECK_ERROR(glEnableVertexAttribArray(compositeShader.a_pos)); |