Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
glfRenderTarget.hh
1 /*
2  This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4  Copyright (C) 2003-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 __glfRenderTarget_hh__
26 #define __glfRenderTarget_hh__
27 
28 #include <Base/Image/ImageBase.hh>
29 #include "glfCommon.hh"
30 
31 namespace BIAS {
32 
33  /**
34  * \brief Interface for render targets.
35  * \ingroup g_openglframework
36  * \author jkollmann
37  */
38  class BIASOpenGLFramework_EXPORT glfRenderTarget {
39  public:
40  virtual ~glfRenderTarget() {}
41 
42  /**
43  * Clears the color buffer of the render target with the given color.
44  * The color (0,0,0,0) is the default clear color in OpenGL.
45  */
46  void ClearColorBuffer(float red = 0.0f, float green = 0.0f, float blue = 0.0f, float alpha = 0.0f);
47 
48  /**
49  * Clears the depth buffer of the render target with the given value.
50  * The value 1 is the default clear value for depth buffers in OpenGL.
51  */
52  void ClearDepthBuffer(float depth = 1.0f);
53 
54  /**
55  * Clears the accumulation buffer of the render target with the given color.
56  * The color (0,0,0,0) is the default clear color in OpenGL.
57  */
58  void ClearAccumBuffer(float red = 0.0f, float green = 0.0f, float blue = 0.0f, float alpha = 0.0f);
59 
60  /**
61  * Clears the stencil buffer of the render target with the given value.
62  * The value 0 is the default clear value for stencil buffers in OpenGL.
63  */
64  void ClearStencilBuffer(int s = 0);
65 
66  enum BufferType {
69  BUFFER_STENCIL
70  };
71 
72  /**
73  * Copies the contents of a buffer to an image.
74  */
75  void ReadBuffer(BIAS::ImageBase& image, BufferType bufferType, int x, int y, int width, int height);
76 
77  /**
78  * Makes this render target the currently used render target.
79  * This must call <code>glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, ?)</code>.
80  */
81  virtual void Bind() const = 0;
82  };
83 
84 } // namespace BIAS
85 
86 #endif // __glfRenderTarget_hh__
Interface for render targets.
This is the base class for images in BIAS.
Definition: ImageBase.hh:102