1 // Copyright (C) 2015 The Android Open Source Project
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 #ifndef TEXTURE_DRAW_H
16 #define TEXTURE_DRAW_H
19 #include <GLES2/gl2.h>
21 // Helper class used to draw a simple texture to the current framebuffer.
22 // Usage is pretty simple:
24 // 1) Create a TextureDraw instance, passing the current EGLDisplay to it.
26 // 2) Each time you want to draw a texture, call draw(texture, rotation),
27 // where |texture| is the name of a GLES 2.x texture object, and
28 // |rotation| is an angle in degrees describing the clockwise rotation
29 // in the GL y-upwards coordinate space. This function fills the whole
30 // framebuffer with texture content.
34 // Create a new instance.
35 TextureDraw(EGLDisplay display);
40 // Fill the current framebuffer with the content of |texture|, which must
41 // be the name of a GLES 2.x texture object.
42 bool draw(GLuint texture);
46 GLuint mFragmentShader;
55 #endif // TEXTURE_DRAW_H