libmoldeo (Moldeo 1.0 Core)  1.0
libmoldeo is the group of objects and functions that executes the basic operations of Moldeo 1.0 Platform.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
moFBO.h
Go to the documentation of this file.
1 /*******************************************************************************
2 
3  moFBO.h
4 
5  ****************************************************************************
6  * *
7  * This source is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This code is distributed in the hope that it will be useful, but *
13  * WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
15  * General Public License for more details. *
16  * *
17  * A copy of the GNU General Public License is available on the World *
18  * Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
19  * obtain it by writing to the Free Software Foundation, *
20  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  * *
22  ****************************************************************************
23 
24  Copyright(C) 2006 Fabricio Costa
25 
26  Authors:
27  Fabricio Costa
28  Andrés Colubri
29 
30 *******************************************************************************/
31 
32 #ifndef __MO_FBO_H__
33 #define __MO_FBO_H__
34 
35 #include "moTypes.h"
36 #include "moAbstract.h"
37 
38 #define MO_FRAMEBUFFER_FULL 0
39 #define MO_FRAMEBUFFER_INVALID_TEX 1
40 #define MO_MAX_FBO_STACK_SIZE 10
41 
42 #ifdef OPENGLESV2
43 #define GL_MAX_COLOR_ATTACHMENTS_EXT 1
44 #endif
45 
46 #define MO_MAX_COLOR_ATTACHMENTS_EXT GL_MAX_COLOR_ATTACHMENTS_EXT
47 
48 
49 class moGLManager;
50 
61 {
62  public:
66  moFBO();
70  virtual ~moFBO();
71 
77  virtual MOboolean Init(moGLManager* p_gl);
82  virtual MOboolean Finish();
83 
88  MOboolean HasDepthBuffer() { return m_has_depth_buffer; }
93  MOboolean HasStencilBuffer() { return m_has_stencil_buffer; }
97  MOboolean AddDepthStencilBuffer();
98 
103  void Bind();
107  void Unbind();
108 
113  void SetReadTexture(MOuint p_attach_point);
118  void SetDrawTexture(MOuint p_attach_point);
131  void SetReadTexture(MOuint p_glid, MOuint p_width, MOuint p_height, const moTexParam& p_param, MOuint p_attach_point = 0);
144  void SetDrawTexture(MOuint p_glid, MOuint p_width, MOuint p_height, const moTexParam& p_param, MOuint p_attach_point = 0);
145 
151  MOint GetColorAttachPoint(MOuint p_attach_point);
157  MOint GetTextureGLId(MOuint p_attach_point);
163  MOint GetColorAttachPointIndex(MOuint p_glid);
164 
169  MOuint GetColorAttachPointsCount() { return m_num_color_attach_points; }
170 
180  MOuint AddTexture(MOuint p_width, MOuint p_height, const moTexParam& p_param, MOuint p_glid, MOuint &p_attach_point);
181 
191  MOuint AttachTexture(MOuint p_width, MOuint p_height, const moTexParam& p_param, MOuint p_glid, MOuint p_attach_point);
195  void ClearAttachements();
196 
201  MOuint CheckStatus() const ;
202 
212  MOboolean IsValidTexture(MOuint p_width, MOuint p_height, const moTexParam& p_param) const ;
213 
218  MOuint GetGLId() const { return m_fbo; }
223  MOuint GetTarget() const { return m_target; }
228  MOuint GetInternalFormat() const { return m_internal_format; }
233  MOuint GetWidth() const { return m_width; }
238  MOuint GetHeight() const { return m_height; }
239  private:
240  moGLManager* m_gl;
241 
242  MOuint m_fbo;
243 
244  GLenum m_target;
245  GLint m_internal_format;
246  MOuint m_width;
247  MOuint m_height;
248 
249  MOboolean m_has_depth_buffer;
250  MOboolean m_has_stencil_buffer;
251  MOuint m_DepthStencilTex;
252 
253  MOuint m_num_color_attach_points;
254  MOuint m_tex_glid_array[MO_MAX_COLOR_ATTACHMENTS_EXT];
255  MOuint m_attach_points_array[MO_MAX_COLOR_ATTACHMENTS_EXT];
256 
257  void InitAttachPointsArray();
258 };
259 
260 moDeclareExportedDynamicArray( moFBO*, moFBOArray);
261 
262 #include "moGLManager.h"
263 
264 #endif
265 
Parámetros internos de una textura.
Definition: moTypes.h:543
MOboolean HasDepthBuffer()
Definition: moFBO.h:88
MOuint GetColorAttachPointsCount()
Definition: moFBO.h:169
virtual MOboolean Finish()
Finaliza el objeto, libera recursos.
Definition: moAbstract.cpp:147
#define MOboolean
Definition: moTypes.h:385
MOuint GetTarget() const
Definition: moFBO.h:223
Clase base abstracta de donde deben derivar los objetos [virtual pura].
Definition: moAbstract.h:191
virtual MOboolean Init()
Inicializa el objeto.
Definition: moAbstract.cpp:141
#define LIBMOLDEO_API
Definition: moTypes.h:180
Definition: moFBO.h:60
MOuint GetWidth() const
Definition: moFBO.h:233
#define MO_MAX_COLOR_ATTACHMENTS_EXT
Definition: moFBO.h:46
#define MOint
Definition: moTypes.h:388
moDeclareExportedDynamicArray(moFBO *, moFBOArray)
MOuint GetInternalFormat() const
Definition: moFBO.h:228
MOuint GetHeight() const
Definition: moFBO.h:238
manejador de operaciones comunes de Open GL
Definition: moGLManager.h:154
MOuint GetGLId() const
Definition: moFBO.h:218
#define MOuint
Definition: moTypes.h:387
MOboolean HasStencilBuffer()
Definition: moFBO.h:93