Moved Core Rendering API from devel-api to public-api
[platform/core/uifw/dali-core.git] / dali / internal / render / renderers / render-frame-buffer.h
1 #ifndef DALI_INTERNAL_RENDER_FRAME_BUFFER_H
2 #define DALI_INTERNAL_RENDER_FRAME_BUFFER_H
3
4 /*
5  * Copyright (c) 2016 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 // INTERNAL INCLUDES
21 #include <dali/public-api/rendering/frame-buffer.h>
22 #include <dali/internal/render/gl-resources/context.h>
23 #include <dali/internal/render/renderers/render-sampler.h>
24 #include <dali/integration-api/gl-defines.h>
25 #include <dali/integration-api/resource-declarations.h>
26
27 namespace Dali
28 {
29 namespace Internal
30 {
31 namespace Render
32 {
33 class NewTexture;
34
35 class FrameBuffer
36 {
37 public:
38
39   typedef Dali::FrameBuffer::Format Format;
40
41   /**
42    * Constructor
43    * @param[in] width The width of the FrameBuffer
44    * @param[in] height The height of the FrameBuffer
45    * @param[in] format The format of the FrameBuffer
46    */
47   FrameBuffer( unsigned int width, unsigned int height, Format format );
48
49   /**
50    * Destructor
51    */
52   ~FrameBuffer();
53
54   /**
55    * Creates a FrameBuffer object in the GPU.
56    * @param[in] context The GL context
57    */
58   void Initialize(Context& context);
59
60   /**
61    * Deletes the framebuffer object from the GPU
62    * @param[in] context The GL context
63    */
64   void Destroy( Context& context );
65
66   /**
67    * @brief Attach a texture for color rendering
68    * param[in] context The GL context
69    * @param[in] texture The texture that will be used as output when rendering
70    * @param[in] mipmapLevel The mipmap of the texture to be attached
71    * @param[in] layer Indicates which layer of a cube map or array texture to attach. Unused for 2D textures
72    */
73   void AttachColorTexture( Context& context, Render::NewTexture* texture, unsigned int mipmapLevel, unsigned int layer );
74
75   /**
76    * @brief Bind the framebuffer
77    * @param[in] context The GL context
78    */
79   void Bind( Context& context );
80
81   /**
82    * @brief Get the width of the FrameBuffer
83    * @return The width of the framebuffer
84    */
85   unsigned int GetWidth() const;
86
87   /**
88    * @brief Get the height of the FrameBuffer
89    * @return The height of the framebuffer
90    */
91   unsigned int GetHeight() const;
92
93 private:
94
95   GLuint mId;
96   GLuint mDepthBuffer;
97   GLuint mStencilBuffer;
98   unsigned int mWidth;
99   unsigned int mHeight;
100 };
101
102
103 } // namespace Render
104
105 } // namespace Internal
106
107 } // namespace Dali
108
109
110 #endif //  DALI_INTERNAL_RENDER_FRAME_BUFFER_H