SLProject
4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
|
#include <SLGLDepthBuffer.h>
Public Member Functions | |
SLGLDepthBuffer (const SLVec2i &dimensions, SLenum magFilter=GL_NEAREST, SLenum minFilter=GL_NEAREST, SLint wrap=GL_REPEAT, SLfloat borderColor[]=nullptr, SLenum target=GL_TEXTURE_2D, SLstring name="SM-DepthBuffer") | |
~SLGLDepthBuffer () | |
SLint | texID () |
SLint | target () |
void | bindActive (SLuint texUnit) const |
Sets the active texture unit within the shader and binds the texture. More... | |
void | bind () |
Binds the OpenGL frame buffer object for the depth buffer. More... | |
void | unbind () |
Ends the usage of the depth buffer frame buffer. More... | |
void | bindFace (SLenum face) const |
Binds a specific texture face of a cube map depth buffer. More... | |
SLfloat * | readPixels () const |
SLVec2i | dimensions () |
Private Attributes | |
SLVec2i | _dimensions |
Size of the texture. More... | |
SLuint | _fboID |
ID of the FB object. More... | |
SLint | _prevFboID |
ID of the previously bound FB. More... | |
SLuint | _texID |
ID of the texture. More... | |
SLenum | _target |
GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP. More... | |
Private Attributes inherited from SLObject | |
SLstring | _name |
name of an object More... | |
SLstring | _url |
uniform resource locator More... | |
Additional Inherited Members | |
Private Member Functions inherited from SLObject | |
SLObject (const SLstring &Name="", const SLstring &url="") | |
virtual | ~SLObject () |
void | name (const SLstring &Name) |
void | url (const SLstring &url) |
const SLstring & | name () const |
const SLstring & | url () const |
Definition at line 19 of file SLGLDepthBuffer.h.
SLGLDepthBuffer::SLGLDepthBuffer | ( | const SLVec2i & | dimensions, |
SLenum | magFilter = GL_NEAREST , |
||
SLenum | minFilter = GL_NEAREST , |
||
SLint | wrap = GL_REPEAT , |
||
SLfloat | borderColor[] = nullptr , |
||
SLenum | target = GL_TEXTURE_2D , |
||
SLstring | name = "SM-DepthBuffer" |
||
) |
Constructor for OpenGL depth buffer framebuffer used in shadow mapping
dimensions | 2D vector pixel dimensions |
magFilter | OpenGL magnification filter enum |
minFilter | OpenGL minification filter enum |
wrap | OpenGL texture wrapping enum |
borderColor | |
target | OpenGL texture target enum GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP |
name | Name of the depth buffer |
Definition at line 26 of file SLGLDepthBuffer.cpp.
SLGLDepthBuffer::~SLGLDepthBuffer | ( | ) |
Definition at line 127 of file SLGLDepthBuffer.cpp.
void SLGLDepthBuffer::bind | ( | ) |
Binds the OpenGL frame buffer object for the depth buffer.
Definition at line 168 of file SLGLDepthBuffer.cpp.
Sets the active texture unit within the shader and binds the texture.
The uniform location loc must be requested before with glUniformLocation. The texture unit value must correspond to the number that is set with glUniform1i(loc, texUnit).
texUnit | Texture Unit value |
Definition at line 143 of file SLGLDepthBuffer.cpp.
Binds a specific texture face of a cube map depth buffer.
Definition at line 187 of file SLGLDepthBuffer.cpp.
|
inline |
Definition at line 38 of file SLGLDepthBuffer.h.
SLfloat * SLGLDepthBuffer::readPixels | ( | ) | const |
Definition at line 152 of file SLGLDepthBuffer.cpp.
|
inline |
Definition at line 32 of file SLGLDepthBuffer.h.
|
inline |
Definition at line 31 of file SLGLDepthBuffer.h.
void SLGLDepthBuffer::unbind | ( | ) |
Ends the usage of the depth buffer frame buffer.
Definition at line 178 of file SLGLDepthBuffer.cpp.
|
private |
Size of the texture.
Definition at line 41 of file SLGLDepthBuffer.h.
|
private |
ID of the FB object.
Definition at line 42 of file SLGLDepthBuffer.h.
|
private |
ID of the previously bound FB.
Definition at line 43 of file SLGLDepthBuffer.h.
|
private |
GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP.
Definition at line 45 of file SLGLDepthBuffer.h.
|
private |
ID of the texture.
Definition at line 44 of file SLGLDepthBuffer.h.