OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #import "RTCShader.h" | 11 #import "RTCShader.h" |
12 | 12 |
13 #if TARGET_OS_IPHONE | 13 #if TARGET_OS_IPHONE |
14 #import <OpenGLES/ES3/gl.h> | 14 #import <OpenGLES/ES3/gl.h> |
15 #else | 15 #else |
16 #import <OpenGL/gl3.h> | 16 #import <OpenGL/gl3.h> |
17 #endif | 17 #endif |
18 | 18 |
19 #include <algorithm> | 19 #include <algorithm> |
20 #include <array> | 20 #include <array> |
21 #include <memory> | 21 #include <memory> |
22 | 22 |
23 #import "RTCOpenGLDefines.h" | 23 #import "RTCOpenGLDefines.h" |
24 | 24 |
25 #include "webrtc/base/checks.h" | 25 #include "webrtc/rtc_base/checks.h" |
26 #include "webrtc/base/logging.h" | 26 #include "webrtc/rtc_base/logging.h" |
27 | 27 |
28 // Vertex shader doesn't do anything except pass coordinates through. | 28 // Vertex shader doesn't do anything except pass coordinates through. |
29 const char kRTCVertexShaderSource[] = | 29 const char kRTCVertexShaderSource[] = |
30 SHADER_VERSION | 30 SHADER_VERSION |
31 VERTEX_SHADER_IN " vec2 position;\n" | 31 VERTEX_SHADER_IN " vec2 position;\n" |
32 VERTEX_SHADER_IN " vec2 texcoord;\n" | 32 VERTEX_SHADER_IN " vec2 texcoord;\n" |
33 VERTEX_SHADER_OUT " vec2 v_texcoord;\n" | 33 VERTEX_SHADER_OUT " vec2 v_texcoord;\n" |
34 "void main() {\n" | 34 "void main() {\n" |
35 " gl_Position = vec4(position.x, position.y, 0.0, 1.0);\n" | 35 " gl_Position = vec4(position.x, position.y, 0.0, 1.0);\n" |
36 " v_texcoord = texcoord;\n" | 36 " v_texcoord = texcoord;\n" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 const GLfloat gVertices[] = { | 180 const GLfloat gVertices[] = { |
181 // X, Y, U, V. | 181 // X, Y, U, V. |
182 -1, -1, UVCoords[0][0], UVCoords[0][1], | 182 -1, -1, UVCoords[0][0], UVCoords[0][1], |
183 1, -1, UVCoords[1][0], UVCoords[1][1], | 183 1, -1, UVCoords[1][0], UVCoords[1][1], |
184 1, 1, UVCoords[2][0], UVCoords[2][1], | 184 1, 1, UVCoords[2][0], UVCoords[2][1], |
185 -1, 1, UVCoords[3][0], UVCoords[3][1], | 185 -1, 1, UVCoords[3][0], UVCoords[3][1], |
186 }; | 186 }; |
187 | 187 |
188 glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(gVertices), gVertices); | 188 glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(gVertices), gVertices); |
189 } | 189 } |
OLD | NEW |