Mir
server_example_adorning_compositor.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2015, 2016 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: Kevin DuBois <kevin.dubois@canonical.com>
17  */
18 
19 #ifndef MIR_EXAMPLES_ADORNING_COMPOSITOR_H_
20 #define MIR_EXAMPLES_ADORNING_COMPOSITOR_H_
22 #include <GLES2/gl2.h>
23 #include <tuple>
24 
25 namespace mir
26 {
27 namespace graphics
28 {
29 class DisplayBuffer;
30 }
31 namespace renderer { namespace gl { class RenderTarget; }}
32 namespace compositor { class CompositorReport; }
33 
34 namespace examples
35 {
37 {
38 public:
40  graphics::DisplayBuffer&, std::tuple<float, float, float> const& background_rgb,
41  std::shared_ptr<compositor::CompositorReport> const& report);
42 
43  void composite(compositor::SceneElementSequence&& scene_sequence) override;
44 private:
46  renderer::gl::RenderTarget* const render_target;
47  GLchar const*const vert_shader_src;
48  GLchar const*const frag_shader_src;
49  bool current;
50  struct Shader
51  {
52  Shader(GLchar const* const* src, GLuint type);
53  ~Shader();
54  GLuint shader;
55  } vertex, fragment;
56  struct Program
57  {
58  Program(Shader& vertex, Shader& fragment);
59  ~Program();
60  GLuint program;
61  } program;
62 
63  GLfloat vertex_data[16]
64  {
65  0.0f, 0.0f, 0.0f, 1.0f,
66  0.0f, 1.0f, 0.0f, 1.0f,
67  1.0f, 0.0f, 0.0f, 1.0f,
68  1.0f, 1.0f, 0.0f, 1.0f,
69  };
70  GLfloat uv_data[8]
71  {
72  0.0f, 0.0f,
73  0.0f, 1.0f,
74  1.0f, 0.0f,
75  1.0f, 1.0f,
76 
77  };
78 
79  GLuint vPositionAttr;
80  GLuint uvCoord;
81  GLuint scaleUniform;
82  GLuint posUniform;
83  GLuint alphaUniform;
84  GLuint texture;
85 
86  std::shared_ptr<compositor::CompositorReport> const report;
87 };
88 }
89 }
90 
91 #endif /* MIR_EXAMPLES_ADORNING_COMPOSITOR_H_ */
Definition: as_render_target.h:27
Interface to an output framebuffer.
Definition: display_buffer.h:47
std::vector< std::shared_ptr< SceneElement > > SceneElementSequence
Definition: scene.h:38
Definition: display_buffer_compositor.h:30
Definition: compositor_report.h:29
GLfloat vertex_data[]
Definition: graphics_utils.cpp:52
Definition: render_target.h:29
GLfloat uv_data[]
Definition: graphics_utils.cpp:60
Definition: server_example_adorning_compositor.h:36

Copyright © 2012-2016 Canonical Ltd.
Generated on Mon Jun 5 11:07:25 UTC 2017