OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "media/tools/player_x11/gl_video_renderer.h" | 5 #include "media/tools/player_x11/gl_video_renderer.h" |
6 | 6 |
7 #include <X11/Xutil.h> | 7 #include <X11/Xutil.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 }; | 60 }; |
61 | 61 |
62 // Vertices for a full screen quad. | 62 // Vertices for a full screen quad. |
63 static const float kVertices[8] = { | 63 static const float kVertices[8] = { |
64 -1.f, 1.f, | 64 -1.f, 1.f, |
65 -1.f, -1.f, | 65 -1.f, -1.f, |
66 1.f, 1.f, | 66 1.f, 1.f, |
67 1.f, -1.f, | 67 1.f, -1.f, |
68 }; | 68 }; |
69 | 69 |
70 // Texture Coordinates mapping the entire texture. | |
71 static const float kTextureCoords[8] = { | |
72 0, 0, | |
73 0, 1, | |
74 1, 0, | |
75 1, 1, | |
76 }; | |
77 | |
78 // Pass-through vertex shader. | 70 // Pass-through vertex shader. |
79 static const char kVertexShader[] = | 71 static const char kVertexShader[] = |
80 "varying vec2 interp_tc;\n" | 72 "varying vec2 interp_tc;\n" |
81 "\n" | 73 "\n" |
82 "attribute vec4 in_pos;\n" | 74 "attribute vec4 in_pos;\n" |
83 "attribute vec2 in_tc;\n" | 75 "attribute vec2 in_tc;\n" |
84 "\n" | 76 "\n" |
85 "void main() {\n" | 77 "void main() {\n" |
86 " interp_tc = in_tc;\n" | 78 " interp_tc = in_tc;\n" |
87 " gl_Position = in_pos;\n" | 79 " gl_Position = in_pos;\n" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 verts[0] = x0; verts[1] = y0; | 240 verts[0] = x0; verts[1] = y0; |
249 verts[2] = x0; verts[3] = y1; | 241 verts[2] = x0; verts[3] = y1; |
250 verts[4] = x1; verts[5] = y0; | 242 verts[4] = x1; verts[5] = y0; |
251 verts[6] = x1; verts[7] = y1; | 243 verts[6] = x1; verts[7] = y1; |
252 glVertexAttribPointer(tc_location, 2, GL_FLOAT, GL_FALSE, 0, verts); | 244 glVertexAttribPointer(tc_location, 2, GL_FLOAT, GL_FALSE, 0, verts); |
253 | 245 |
254 // We are getting called on a thread. Release the context so that it can be | 246 // We are getting called on a thread. Release the context so that it can be |
255 // made current on the main thread. | 247 // made current on the main thread. |
256 glXMakeCurrent(display_, 0, NULL); | 248 glXMakeCurrent(display_, 0, NULL); |
257 } | 249 } |
OLD | NEW |