f44286b03dcfca5fe33c92055b15b447d9494f6f
[platform/core/uifw/dali-core.git] / dali / internal / render / gl-resources / frame-buffer-texture.h
1 #ifndef __DALI_INTERNAL_FRAME_BUFFER_TEXTURE_H__
2 #define __DALI_INTERNAL_FRAME_BUFFER_TEXTURE_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <string>
23
24 // INTERNAL INCLUDES
25 #include <dali/internal/render/gl-resources/texture.h>
26 #include <dali/integration-api/bitmap.h>
27 #include <dali/integration-api/debug.h>
28
29 namespace Dali
30 {
31
32 namespace Internal
33 {
34
35 /**
36  * Texture class.
37  * Used as a frame buffer for RenderTask
38  */
39 class FrameBufferTexture : public Texture
40 {
41 public:
42   /**
43    * Creates a new texture object
44    * @param[in] width       The width (pixels)
45    * @param[in] height      The height (pixels)
46    * @param[in] pixelFormat The pixel format
47    * @param     context The GL context
48    */
49   FrameBufferTexture(unsigned int width, unsigned int height, Pixel::Format pixelFormat, Context& context);
50
51   /**
52    * Destructor.
53    */
54   virtual ~FrameBufferTexture();
55
56   /**
57    * @copydoc Texture::IsFullyOpaque
58    */
59   virtual bool IsFullyOpaque() const;
60
61   /**
62    * @copydoc Texture::HasAlphaChannel
63    */
64   virtual bool HasAlphaChannel() const;
65
66   /**
67    * @copydoc Texture::Init
68    */
69   virtual bool Init();
70
71   /**
72    * Prepare FBO for rendering.
73    * @return true if the FBO is prepared and its status is GL_FRAMEBUFFER_COMPLETE, otherwise false.
74    */
75   virtual bool Prepare();
76
77 protected:
78   unsigned int mFrameBufferName;
79   unsigned int mRenderBufferName;
80
81   /**
82    * @copydoc Texture::CreateGlTexture
83    */
84   virtual bool CreateGlTexture();
85
86   /**
87    * @copydoc Texture::GlCleanup
88    */
89   virtual void GlCleanup();
90
91 }; // class FrameBufferTexture
92
93 }  //namespace Internal
94
95 } //namespace Dali
96 #endif //__DALI_INTERNAL_FRAME_BUFFER_TEXTURE_H__
97