OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | |
3 * | |
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 | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #ifndef WEBRTC_MODULES_VIDEO_RENDER_IOS_OPEN_GLES20_H_ | |
12 #define WEBRTC_MODULES_VIDEO_RENDER_IOS_OPEN_GLES20_H_ | |
13 | |
14 #include <OpenGLES/ES2/glext.h> | |
15 | |
16 #include "webrtc/modules/video_render/video_render_defines.h" | |
17 | |
18 /* | |
19 * This OpenGles20 is the class of renderer for VideoFrame into a GLES 2.0 | |
20 * windows used in the VideoRenderIosView class. | |
21 */ | |
22 namespace webrtc { | |
23 class OpenGles20 { | |
24 public: | |
25 OpenGles20(); | |
26 ~OpenGles20(); | |
27 | |
28 bool Setup(int32_t width, int32_t height); | |
29 bool Render(const VideoFrame& frame); | |
30 | |
31 // SetCoordinates | |
32 // Sets the coordinates where the stream shall be rendered. | |
33 // Values must be between 0 and 1. | |
34 bool SetCoordinates(const float z_order, | |
35 const float left, | |
36 const float top, | |
37 const float right, | |
38 const float bottom); | |
39 | |
40 private: | |
41 // Compile and load the vertex and fragment shaders defined at the top of | |
42 // open_gles20.mm | |
43 GLuint LoadShader(GLenum shader_type, const char* shader_source); | |
44 | |
45 GLuint CreateProgram(const char* vertex_source, const char* fragment_source); | |
46 | |
47 // Initialize the textures by the frame width and height | |
48 void SetupTextures(const VideoFrame& frame); | |
49 | |
50 // Update the textures by the YUV data from the frame | |
51 void UpdateTextures(const VideoFrame& frame); | |
52 | |
53 GLuint texture_ids_[3]; // Texture id of Y,U and V texture. | |
54 GLuint program_; | |
55 GLsizei texture_width_; | |
56 GLsizei texture_height_; | |
57 | |
58 GLfloat vertices_[20]; | |
59 static const char indices_[]; | |
60 static const char vertext_shader_[]; | |
61 static const char fragment_shader_[]; | |
62 }; | |
63 } // namespace webrtc | |
64 #endif // WEBRTC_MODULES_VIDEO_RENDER_IOS_OPEN_GLES20_H_ | |
OLD | NEW |