~hikiko/mir/mir.unity8-desktop-session

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Daniel van Vugt, Ubuntu daily release
  • Date: 2014-01-08 02:04:38 UTC
  • mfrom: (1.1.54)
  • Revision ID: package-import@ubuntu.com-20140108020438-ikbu7qqm9v2l026y
Tags: 0.1.3+14.04.20140108-0ubuntu1
[ Daniel van Vugt ]
* Preparing for release 0.1.3

[ Ubuntu daily release ]
* Automatic snapshot from revision 1170

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include <boost/throw_exception.hpp>
27
27
#include <stdexcept>
28
28
 
 
29
namespace mg = mir::graphics;
29
30
namespace mc = mir::compositor;
30
31
namespace geom = mir::geometry;
31
32
 
235
236
}
236
237
 
237
238
mc::GLRenderer::GLRenderer(geom::Rectangle const& display_area)
238
 
    : frameno{0}
239
239
{
240
240
    resources.setup(display_area);
241
241
}
242
242
 
243
 
void mc::GLRenderer::render(
244
 
    std::function<void(std::shared_ptr<void> const&)> save_resource,
245
 
    CompositingCriteria const& criteria,
246
 
    BufferStream& stream)
 
243
void mc::GLRenderer::render(CompositingCriteria const& criteria, mg::Buffer& buffer) const
247
244
{
248
245
    glUseProgram(resources.program);
249
246
 
273
270
    /* Use the renderable's texture */
274
271
    glBindTexture(GL_TEXTURE_2D, resources.texture);
275
272
 
276
 
    auto region_resource = stream.lock_compositor_buffer(frameno);
277
 
    region_resource->bind_to_texture();
278
 
    save_resource(region_resource);
 
273
    buffer.bind_to_texture();
279
274
 
280
275
    /* Draw */
281
276
    glEnableVertexAttribArray(resources.position_attr_loc);
285
280
    glDisableVertexAttribArray(resources.position_attr_loc);
286
281
}
287
282
 
288
 
void mc::GLRenderer::clear(unsigned long frame)
 
283
void mc::GLRenderer::clear() const
289
284
{
290
 
    frameno = frame;
291
285
    glClear(GL_COLOR_BUFFER_BIT);
292
286
}
293