OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_COMMON_GPU_MEDIA_GLES2_EXTERNAL_TEXTURE_COPIER_H_ |
| 6 #define CONTENT_COMMON_GPU_MEDIA_GLES2_EXTERNAL_TEXTURE_COPIER_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "third_party/angle/include/GLES2/gl2.h" |
| 10 #include "third_party/angle/include/GLES2/gl2ext.h" |
| 11 |
| 12 namespace content { |
| 13 |
| 14 // A utility class which copies the given external texture |
| 15 // (GL_TEXTURE_EXTERNAL_OES) to the target texture (GL_TEXTURE_2D) by using |
| 16 // framebuffer. |
| 17 class Gles2ExternalTextureCopier { |
| 18 public: |
| 19 Gles2ExternalTextureCopier(); |
| 20 virtual ~Gles2ExternalTextureCopier(); |
| 21 |
| 22 bool Init(int32 width, int32 height); |
| 23 |
| 24 bool Copy(GLuint source_texture_id, GLenum source_target, |
| 25 float transfrom_matrix[16], |
| 26 GLuint destination_texture_id, GLenum destination_target); |
| 27 |
| 28 private: |
| 29 bool SetupGraphics(); |
| 30 void RenderFrame(int32 width, int32 height, GLuint texture_id); |
| 31 bool SetupFrameBuffer(); |
| 32 |
| 33 bool initialized_; |
| 34 int32 width_; |
| 35 int32 height_; |
| 36 GLuint framebuffer_id_; |
| 37 GLuint renderbuffer_id_; |
| 38 GLuint program_; |
| 39 GLuint position_handle_; |
| 40 GLuint st_matrix_handle_; |
| 41 GLuint mvp_matrix_handle_; |
| 42 GLuint texture_handle_; |
| 43 GLfloat st_matrix_[16]; |
| 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(Gles2ExternalTextureCopier); |
| 46 }; |
| 47 |
| 48 } // namespace content |
| 49 |
| 50 #endif // CONTENT_COMMON_GPU_MEDIA_GLES2_EXTERNAL_TEXTURE_COPIER_H_ |
OLD | NEW |