~kdub/mir/fix-1663062-step2

« back to all changes in this revision

Viewing changes to src/server/compositor/screencast_display_buffer.cpp

  • Committer: Kevin DuBois
  • Date: 2017-02-14 17:50:37 UTC
  • mfrom: (4023.2.8 development-branch)
  • Revision ID: kevin.dubois@canonical.com-20170214175037-kbhn11p8853u96o7
mergeĀ inĀ mir

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include "mir/graphics/display.h"
24
24
#include "mir/graphics/transformation.h"
25
25
#include "mir/renderer/gl/context.h"
26
 
#include "mir/renderer/gl/texture_source.h"
 
26
#include "mir/renderer/gl/texture_target.h"
27
27
#include "mir/renderer/gl/context_source.h"
28
28
#include "mir/raii.h"
29
29
 
36
36
 
37
37
namespace
38
38
{
39
 
auto as_texture_source(mg::Buffer* buffer)
 
39
auto as_texture_target(mg::Buffer* buffer)
40
40
{
41
 
    auto tex = dynamic_cast<mrgl::TextureSource*>(buffer->native_buffer_base());
 
41
    auto tex = dynamic_cast<mrgl::TextureTarget*>(buffer->native_buffer_base());
42
42
    if (!tex)
43
 
        BOOST_THROW_EXCEPTION(std::logic_error("Buffer does not support GL rendering"));
 
43
        BOOST_THROW_EXCEPTION(std::invalid_argument("Buffer does not support being rendered to as a GL target"));
44
44
    return tex;
45
45
}
46
46
 
134
134
    if (!current_buffer)
135
135
        current_buffer = free_queue.next_buffer();
136
136
 
137
 
    auto texture_source = as_texture_source(current_buffer.get());
 
137
    auto texture_target = as_texture_target(current_buffer.get());
138
138
    glBindTexture(GL_TEXTURE_2D, color_tex);
139
 
    texture_source->bind();
 
139
    texture_target->bind_for_write();
140
140
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
141
141
                           GL_TEXTURE_2D, color_tex, 0);
142
142