OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef REMOTING_CLIENT_OPENGL_GL_CANVAS_H_ | 5 #ifndef REMOTING_CLIENT_OPENGL_GL_CANVAS_H_ |
6 #define REMOTING_CLIENT_OPENGL_GL_CANVAS_H_ | 6 #define REMOTING_CLIENT_OPENGL_GL_CANVAS_H_ |
7 | 7 |
8 #include <array> | 8 #include <array> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // height. m2 and m5 defines the offset of the upper-left corner in percentage | 43 // height. m2 and m5 defines the offset of the upper-left corner in percentage |
44 // of the view's width or height. An identity matrix will stretch the canvas | 44 // of the view's width or height. An identity matrix will stretch the canvas |
45 // to fit the whole view. | 45 // to fit the whole view. |
46 void SetNormalizedTransformation(const std::array<float, 9>& matrix); | 46 void SetNormalizedTransformation(const std::array<float, 9>& matrix); |
47 | 47 |
48 // Draws the texture on the canvas. Nothing will happen if | 48 // Draws the texture on the canvas. Nothing will happen if |
49 // SetNormalizedTransformation() has not been called. | 49 // SetNormalizedTransformation() has not been called. |
50 // vertex_buffer: reference to the 2x4x2 float vertex buffer. | 50 // vertex_buffer: reference to the 2x4x2 float vertex buffer. |
51 // [ four (x, y) normalized vertex positions on the canvas, | 51 // [ four (x, y) normalized vertex positions on the canvas, |
52 // four (x, y) vertex positions to define the visible area ] | 52 // four (x, y) vertex positions to define the visible area ] |
53 void DrawTexture(int texture_id, GLuint texture_handle, GLuint vertex_buffer); | 53 // alpha_multiplier: Will be multiplied with the alpha channel of the texture. |
| 54 // Passing 1 means no change of the transparency of the |
| 55 // texture. |
| 56 void DrawTexture(int texture_id, |
| 57 GLuint texture_handle, |
| 58 GLuint vertex_buffer, |
| 59 float alpha_multiplier); |
54 | 60 |
55 // Returns the version number of current OpenGL ES context. Either 2 or 3. | 61 // Returns the version number of current OpenGL ES context. Either 2 or 3. |
56 int GetGlVersion() const; | 62 int GetGlVersion() const; |
57 | 63 |
58 private: | 64 private: |
59 int gl_version_; | 65 int gl_version_; |
60 | 66 |
61 // True IFF the transformation has been set. | 67 // True IFF the transformation has been set. |
62 bool transformation_set_ = false; | 68 bool transformation_set_ = false; |
63 | 69 |
64 // Handles. | 70 // Handles. |
65 GLuint vertex_shader_; | 71 GLuint vertex_shader_; |
66 GLuint fragment_shader_; | 72 GLuint fragment_shader_; |
67 GLuint program_; | 73 GLuint program_; |
68 | 74 |
69 // Locations of the corresponding shader attributes. | 75 // Locations of the corresponding shader attributes. |
70 GLuint transform_location_; | 76 GLuint transform_location_; |
71 GLuint texture_location_; | 77 GLuint texture_location_; |
| 78 GLuint alpha_multiplier_location_; |
72 GLuint position_location_; | 79 GLuint position_location_; |
73 GLuint tex_cord_location_; | 80 GLuint tex_cord_location_; |
74 | 81 |
75 base::ThreadChecker thread_checker_; | 82 base::ThreadChecker thread_checker_; |
76 | 83 |
77 DISALLOW_COPY_AND_ASSIGN(GlCanvas); | 84 DISALLOW_COPY_AND_ASSIGN(GlCanvas); |
78 }; | 85 }; |
79 | 86 |
80 } // namespace remoting | 87 } // namespace remoting |
81 | 88 |
82 #endif // REMOTING_CLIENT_OPENGL_GL_CANVAS_H_ | 89 #endif // REMOTING_CLIENT_OPENGL_GL_CANVAS_H_ |
OLD | NEW |