Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
glfDepthBufferMode.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 __glfDepthBufferMode_hh__
26 #define __glfDepthBufferMode_hh__
27 
28 #include "glfCommon.hh"
29 
30 namespace BIAS {
31 
32  /**
33  * \brief Defines the usage of the depth buffer.
34  * \ingroup g_openglframework
35  * \author jkollmann
36  */
37  class BIASOpenGLFramework_EXPORT glfDepthBufferMode {
38  public:
40 
41  virtual ~glfDepthBufferMode() {}
42 
43  /**
44  * Sets whether to use depth buffer tests.
45  * \note: This must be enabled, even you only want
46  * to write to the depth buffer. Use the depth func
47  * GL_ALWAYS to use the depth buffer write-only.
48  */
49  void SetDepthTest(bool enable);
50 
51  /**
52  * Sets whether to write to the depth buffer.
53  */
54  void SetDepthMask(bool flag);
55 
56  /**
57  * Sets the depth buffer comparison function.
58  * Valid values are: GL_NEVER, GL_LESS, GL_EQUAL, GL_LEQUAL, GL_GREATER,
59  * GL_NOTEQUAL, GL_GEQUAL, GL_ALWAYS.
60  */
61  void SetDepthFunc(GLenum depthFunc);
62 
63  /**
64  * Sets the mapping the used range of the depth buffer.
65  * The parameters nearVal and farVal must be in [0,1].
66  */
67  void SetDepthRange(double nearVal, double farVal);
68 
69  /**
70  * Binds the depth buffer mode.
71  */
72  void Bind() const;
73 
74  /**
75  * The default depth buffer mode.
76  */
78 
79  private:
80  bool enableTest_;
81  GLboolean depthMask_;
82  GLenum depthFunc_;
83  GLclampd nearVal_, farVal_;
84  };
85 
86 } // namespace BIAS
87 
88 #endif // __glfDepthBufferMode_hh__
Defines the usage of the depth buffer.
static const glfDepthBufferMode DEFAULT
The default depth buffer mode.