SLProject 4.0.000
SLGLDepthBuffer Class Reference

#include <SLGLDepthBuffer.h>

Inheritance diagram for SLGLDepthBuffer:
[legend]

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...
 
SLfloatreadPixels () 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 SLstringname () const
 
const SLstringurl () const
 

Constructor & Destructor Documentation

◆ SLGLDepthBuffer()

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

Parameters
dimensions2D vector pixel dimensions
magFilterOpenGL magnification filter enum
minFilterOpenGL minification filter enum
wrapOpenGL texture wrapping enum
borderColor
targetOpenGL texture target enum GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP
nameName of the depth buffer

◆ ~SLGLDepthBuffer()

SLGLDepthBuffer::~SLGLDepthBuffer ( )

Member Function Documentation

◆ bind()

void SLGLDepthBuffer::bind ( )

Binds the OpenGL frame buffer object for the depth buffer.

◆ bindActive()

void SLGLDepthBuffer::bindActive ( SLuint  texUnit) const

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).

Parameters
texUnitTexture Unit value

◆ bindFace()

void SLGLDepthBuffer::bindFace ( SLenum  face) const

Binds a specific texture face of a cube map depth buffer.

◆ dimensions()

SLVec2i SLGLDepthBuffer::dimensions ( )
inline

◆ readPixels()

SLfloat * SLGLDepthBuffer::readPixels ( ) const

◆ target()

SLint SLGLDepthBuffer::target ( )
inline

◆ texID()

SLint SLGLDepthBuffer::texID ( )
inline

◆ unbind()

void SLGLDepthBuffer::unbind ( )

Ends the usage of the depth buffer frame buffer.

Member Data Documentation

◆ _dimensions

SLVec2i SLGLDepthBuffer::_dimensions
private

Size of the texture.

◆ _fboID

SLuint SLGLDepthBuffer::_fboID
private

ID of the FB object.

◆ _prevFboID

SLint SLGLDepthBuffer::_prevFboID
private

ID of the previously bound FB.

◆ _target

SLenum SLGLDepthBuffer::_target
private

GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP.

◆ _texID

SLuint SLGLDepthBuffer::_texID
private

ID of the texture.


The documentation for this class was generated from the following files: