Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Unified Diff: remoting/client/opengl/tex_coord_to_view.vert

Issue 2045963004: [Remoting] OpenGL Rendering Layer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/client/opengl/tex_coord_to_view.vert
diff --git a/remoting/client/opengl/tex_coord_to_view.vert b/remoting/client/opengl/tex_coord_to_view.vert
new file mode 100644
index 0000000000000000000000000000000000000000..726a55b8593462c2f83330187bf134272513e6b8
--- /dev/null
+++ b/remoting/client/opengl/tex_coord_to_view.vert
@@ -0,0 +1,31 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
Sergey Ulanov 2016/06/27 23:15:30 Do you need to put shaders in separate files? Why
Yuwei 2016/06/28 01:31:20 I feel like it is more maintainable in this way...
Sergey Ulanov 2016/06/30 00:34:52 This is great stuff, but I don't think we need it.
Yuwei 2016/07/07 22:07:45 Done. Moved shaders into GlCanvas.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Region of the texture to be used (normally the whole texture).
+varying vec2 v_texCoord;
+attribute vec2 a_texCoord;
+
+// Positions to draw the texture on the texture coordinates.
+attribute vec2 a_position;
+
+uniform mat3 u_transform;
+void main()
+{
+ v_texCoord = a_texCoord;
+
+ // (2D) Add projection dimension with value 1.
+ vec3 trans_position = u_transform * vec3(a_position, 1.0);
+
+ // (2D) convert texture position [0, 1] to view position [-1, 1].
+ trans_position = 2.0 * trans_position - 1.0;
+
+ // (2D) Flips the texture.
+ trans_position.y *= -1.0;
+
+ // (3D) Set z coordinate to 0.
+ trans_position.z = 0.0;
Sergey Ulanov 2016/06/27 23:15:30 I think all operations above can be represented as
Yuwei 2016/06/28 01:31:20 That's a good point. Everything here is just linea
+
+ // (3D) Add projection dimension with value 1.
+ gl_Position = vec4(trans_position, 1.0);
+}

Powered by Google App Engine
This is Rietveld 408576698