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 12 matching lines...) Expand all Loading... | |
23 // with the origin at the upper-left corner of the canvas. | 23 // with the origin at the upper-left corner of the canvas. |
24 class GlCanvas { | 24 class GlCanvas { |
25 public: | 25 public: |
26 // gl_version: version number of the OpenGL ES context. Either 2 or 3. | 26 // gl_version: version number of the OpenGL ES context. Either 2 or 3. |
27 GlCanvas(int gl_version); | 27 GlCanvas(int gl_version); |
28 | 28 |
29 ~GlCanvas(); | 29 ~GlCanvas(); |
30 | 30 |
31 // Sets the normalized transformation matrix. This matrix defines how the | 31 // Sets the normalized transformation matrix. This matrix defines how the |
32 // canvas should be shown on the view. | 32 // canvas should be shown on the view. |
33 // 3 by 3 transformation matrix, [ m0, m1, m2, m3, m4, m5, m6, m7, m8 ]. | 33 // 3 by 3 transformation matrix **in column-major order**, i. e. |
34 // [ m0, m3, m6, m1, m4, m7, m2, m5, m8 ]. | |
Sergey Ulanov
2016/07/27 17:45:33
This is not intuitive and is hard to work with. Ma
Yuwei
2016/07/27 18:23:10
Done. Wrote separate function for matrix transposi
| |
34 // The matrix will be multiplied with the positions (with projective space, | 35 // The matrix will be multiplied with the positions (with projective space, |
35 // (x, y, 1)) to draw the textures with the right zoom and pan configuration. | 36 // (x, y, 1)) to draw the textures with the right zoom and pan configuration. |
36 // | 37 // |
37 // | m0, m1, m2, | | x | | 38 // | m0, m1, m2, | | x | |
38 // | m3, m4, m5, | * | y | | 39 // | m3, m4, m5, | * | y | |
39 // | m6, m7, m8 | | 1 | | 40 // | m6, m7, m8 | | 1 | |
40 // | 41 // |
41 // For a typical transformation matrix such that m1=m3=m6=m7=0 and m8=1, m0 | 42 // For a typical transformation matrix such that m1=m3=m6=m7=0 and m8=1, m0 |
42 // and m4 defines the ratio of canvas width or height over view width or | 43 // and m4 defines the ratio of canvas width or height over view width or |
43 // height. m2 and m5 defines the offset of the upper-left corner in percentage | 44 // height. m2 and m5 defines the offset of the upper-left corner in percentage |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 GLuint tex_cord_location_; | 81 GLuint tex_cord_location_; |
81 | 82 |
82 base::ThreadChecker thread_checker_; | 83 base::ThreadChecker thread_checker_; |
83 | 84 |
84 DISALLOW_COPY_AND_ASSIGN(GlCanvas); | 85 DISALLOW_COPY_AND_ASSIGN(GlCanvas); |
85 }; | 86 }; |
86 | 87 |
87 } // namespace remoting | 88 } // namespace remoting |
88 | 89 |
89 #endif // REMOTING_CLIENT_OPENGL_GL_CANVAS_H_ | 90 #endif // REMOTING_CLIENT_OPENGL_GL_CANVAS_H_ |
OLD | NEW |