Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
FramebufferSetup.hh
1 /*
2  This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4  Copyright (C) 2008, 2009 (see file CONTACT for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10  BIAS is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation; either version 2.1 of the License, or
13  (at your option) any later version.
14 
15  BIAS is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with BIAS; if not, write to the Free Software
22  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23  */
24 
25 #ifndef __FramebufferSetup_hh__
26 #define __FramebufferSetup_hh__
27 
28 #include <bias_config.h>
29 
30 #include <OpenGLFramework/Base/glfFramebufferObject.hh>
31 #include <OpenGLFramework/Base/glfTexture2D.hh>
32 
33 #include <vector>
34 
35 
36 namespace BIAS {
37 
38  /*
39  * Class shall support the framebuffer object organization.
40  * It is usefull in a szenario where certain texture to fbo bindings
41  * are (frequently) reoccuring.
42  * \ingroup g_openglframework
43  * \author bartczak 09/2008
44  */
45  class BIASOpenGLFramework_EXPORT FramebufferSetup {
46  public:
48 
49  void LinkFBO(BIAS::glfFramebufferObject* fbo);
50  void ClearColorAttachments();
51  void SetColorAttachment(BIAS::glfTexture* texture, int AttachmentPoint=0);
52  /**
53  * replaces all previous color attachments and through given
54  */
55  void SetColorAttachments(const std::vector<BIAS::glfTexture*>& textures);
56  void SetDepthAttachment(BIAS::glfTexture* texture);
57  void EnableColorClearance(float red = 0.0f, float green = 0.0f, float blue = 0.0f, float alpha = 0.0f);
58  void EnableDepthClearance(float depth = 1.0f);
59  void DisableColorClearance();
60  void DisableDepthClearance();
61 
62  void Execute();
63 
64  /** Returns texture attached to AttachmentPoint if it is a glfTexture2D otherwise NULL.
65  * Also returns NULL if not texture is attached to this attachmentpoint.
66  **/
67  glfTexture2D* GetColorAttachment2D(int AttachmentPoint);
68 
69  private:
71 
72  bool clearColorBuffer_;
73  float clearColor_[4];
74 
75  bool clearDepthBuffer_;
76  float clearDepth_;
77 
78  std::vector<BIAS::glfTexture*> colorAttachments_;
79  BIAS::glfTexture* depthAttachment_;
80 
81  };
82 
83 }
84 
85 
86 #endif
A 2D texture.
Definition: glfTexture2D.hh:40
Base class for textures.
Definition: glfTexture.hh:42