Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gl_renderer.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2012 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17  */
18 
19 #ifndef MIR_COMPOSITOR_GL_RENDERER_H_
20 #define MIR_COMPOSITOR_GL_RENDERER_H_
21 
23 #include "mir/geometry/rectangle.h"
24 #include <GLES2/gl2.h>
25 
26 namespace mir
27 {
28 namespace compositor
29 {
30 
31 class GLRenderer : public Renderer
32 {
33 public:
34  GLRenderer(geometry::Rectangle const& display_area);
35 
36  /* From renderer */
37  void render(std::function<void(std::shared_ptr<void> const&)> save_resource,
38  CompositingCriteria const& info, surfaces::BufferStream& stream);
39  void clear(unsigned long frameno) override;
40 
41  ~GLRenderer() noexcept {}
42 
43 private:
44  class Resources
45  {
46  public:
47  Resources();
48  ~Resources();
49  void setup(geometry::Rectangle const& display_area);
50 
51  GLuint vertex_shader;
52  GLuint fragment_shader;
53  GLuint program;
54  GLuint position_attr_loc;
55  GLuint texcoord_attr_loc;
56  GLuint transform_uniform_loc;
57  GLuint alpha_uniform_loc;
58  GLuint vertex_attribs_vbo;
59  GLuint texture;
60  };
61 
62  Resources resources;
63 
64  unsigned long frameno;
65 };
66 
67 }
68 }
69 
70 #endif // MIR_COMPOSITOR_GL_RENDERER_H_

Copyright © 2012,2013 Canonical Ltd.
Generated on Tue Oct 15 00:23:28 UTC 2013