Mir
server_example_adorning_compositor.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2015 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 examples
33 {
35 {
36 public:
37  AdorningDisplayBufferCompositor(graphics::DisplayBuffer&, std::tuple<float, float, float> const& background_rgb);
38  void composite(compositor::SceneElementSequence&& scene_sequence) override;
39 private:
41  renderer::gl::RenderTarget* const render_target;
42  GLchar const*const vert_shader_src;
43  GLchar const*const frag_shader_src;
44  bool current;
45  struct Shader
46  {
47  Shader(GLchar const* const* src, GLuint type);
48  ~Shader();
49  GLuint shader;
50  } vertex, fragment;
51  struct Program
52  {
53  Program(Shader& vertex, Shader& fragment);
54  ~Program();
55  GLuint program;
56  } program;
57 
58  GLfloat vertex_data[16]
59  {
60  0.0f, 0.0f, 0.0f, 1.0f,
61  0.0f, 1.0f, 0.0f, 1.0f,
62  1.0f, 0.0f, 0.0f, 1.0f,
63  1.0f, 1.0f, 0.0f, 1.0f,
64  };
65  GLfloat uv_data[8]
66  {
67  0.0f, 0.0f,
68  0.0f, 1.0f,
69  1.0f, 0.0f,
70  1.0f, 1.0f,
71 
72  };
73 
74  GLuint vPositionAttr;
75  GLuint uvCoord;
76  GLuint scaleUniform;
77  GLuint posUniform;
78  GLuint alphaUniform;
79  GLuint texture;
80 };
81 }
82 }
83 
84 #endif /* MIR_EXAMPLES_ADORNING_COMPOSITOR_H_ */
All things Mir.
Definition: atomic_callback.h:25
Interface to an output framebuffer.
Definition: display_buffer.h:47
Definition: display_buffer_compositor.h:30
std::vector< std::shared_ptr< SceneElement >> SceneElementSequence
Definition: scene.h:38
void composite(compositor::SceneElementSequence &&scene_sequence) override
Definition: server_example_adorning_compositor.cpp:118
AdorningDisplayBufferCompositor(graphics::DisplayBuffer &, std::tuple< float, float, float > const &background_rgb)
Definition: server_example_adorning_compositor.cpp:69
Definition: render_target.h:29
Definition: server_example_adorning_compositor.h:34

Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Oct 8 16:20:16 UTC 2015