SenOGL  0.2
Library aiming to ease the use of OpenGL
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
Sampler Class Reference

Describes a Sampler object. More...

#include <Sampler.hpp>

Inheritance diagram for Sampler:
OpenGLObject

Public Types

enum  Parameter : GLenum {
  Parameter::MinFilter = GL_TEXTURE_MIN_FILTER, Parameter::MagFilter = GL_TEXTURE_MAG_FILTER, Parameter::MinLoD = GL_TEXTURE_MIN_LOD, Parameter::MaxLoD = GL_TEXTURE_MAX_LOD,
  Parameter::LoDBias = GL_TEXTURE_LOD_BIAS, Parameter::WrapS = GL_TEXTURE_WRAP_S, Parameter::WrapT = GL_TEXTURE_WRAP_T, Parameter::WrapR = GL_TEXTURE_WRAP_R,
  Parameter::BorderColor = GL_TEXTURE_BORDER_COLOR, Parameter::CompareMode = GL_TEXTURE_COMPARE_MODE, Parameter::CompareFunc = GL_TEXTURE_COMPARE_FUNC
}
 Sampler parameters. More...
 

Public Member Functions

 Sampler ()=default
 Default constructor. More...
 
 Sampler (GLuint handle)
 Constructor from an existing sampler name. More...
 
 Sampler (const Sampler &)=default
 
 Sampler (Sampler &&)=default
 
Sampleroperator= (const Sampler &)=default
 
Sampleroperator= (Sampler &&)=default
 
virtual ~Sampler ()
 
void bind (unsigned int unit=0) const
 Binds the sampler to the unit texture 'unit'. More...
 
void unbind (unsigned int unit=0) const
 Unbinds any currently bound sampler to the unit texture 'unit'. More...
 
template<typename T >
void set (Parameter opt, T value) const
 Set the parameter opt for value for this sampler. More...
 
template<typename T >
void setI (Parameter opt, T value) const
 Set the parameter opt for value for this sampler. More...
 
virtual bool isValid () const override
 Returns true if the object seems valid. More...
 
- Public Member Functions inherited from OpenGLObject
 OpenGLObject ()
 
 OpenGLObject (GLuint handle)
 Constructs a instance managing an existing OpenGL Object. More...
 
 OpenGLObject (const OpenGLObject &)=default
 
 OpenGLObject (OpenGLObject &&)=default
 
OpenGLObjectoperator= (const OpenGLObject &)=default
 
OpenGLObjectoperator= (OpenGLObject &&)=default
 
virtual ~OpenGLObject ()
 
virtual void init ()=0
 Generates a OpenGL object name to manage. More...
 
GLuint getName () const
 Returns OpenGL name of the object. More...
 
void setName (GLuint n)
 Sets the OpenGL name of the object managed by this instance /!\ Use with caution ! (assignment operator is probably what you're looking for) More...
 
 operator bool () const
 Syntactic sugar for isValid(). More...
 

Protected Member Functions

void cleanup ()
 Deletes the managed OpenGL object. More...
 

Static Protected Member Functions

static bool isSampler (GLuint name)
 

Additional Inherited Members

- Protected Attributes inherited from OpenGLObject
GLuint _handle
 OpenGL name of the managed object. More...
 

Detailed Description

Describes a Sampler object.

Todo:
Parameter value enums.

Member Enumeration Documentation

enum Sampler::Parameter : GLenum
strong

Sampler parameters.

Enumerator
MinFilter 
MagFilter 
MinLoD 
MaxLoD 
LoDBias 
WrapS 
WrapT 
WrapR 
BorderColor 
CompareMode 
CompareFunc 

Constructor & Destructor Documentation

Sampler::Sampler ( )
default

Default constructor.

Sampler::Sampler ( GLuint  handle)

Constructor from an existing sampler name.

Parameters
handleOpenGL name for an existing sampler.
Sampler::Sampler ( const Sampler )
default
Sampler::Sampler ( Sampler &&  )
default
Sampler::~Sampler ( )
virtual

Member Function Documentation

void Sampler::bind ( unsigned int  unit = 0) const

Binds the sampler to the unit texture 'unit'.

Parameters
unitUnit Texture
void Sampler::cleanup ( )
protectedvirtual

Deletes the managed OpenGL object.

Implements OpenGLObject.

static bool Sampler::isSampler ( GLuint  name)
inlinestaticprotected
virtual bool Sampler::isValid ( ) const
inlineoverridevirtual

Returns true if the object seems valid.

Can be overloaded for concrete types if there is other attributes to test.

Reimplemented from OpenGLObject.

Sampler& Sampler::operator= ( const Sampler )
default
Sampler& Sampler::operator= ( Sampler &&  )
default
template<typename T >
void Sampler::set ( Parameter  opt,
value 
) const
inline

Set the parameter opt for value for this sampler.

Parameters
optSampler parameter.
valueNew value for opt.
template<typename T >
void Sampler::setI ( Parameter  opt,
value 
) const
inline

Set the parameter opt for value for this sampler.

Parameters
optSampler parameter.
valueNew value for opt.
void Sampler::unbind ( unsigned int  unit = 0) const

Unbinds any currently bound sampler to the unit texture 'unit'.

Parameters
unitUnit Texture

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