SenOGL
0.2
Library aiming to ease the use of OpenGL
|
Describes a texture living on the GPU's memory. More...
#include <Texture.hpp>
Classes | |
class | Binder |
Scoped texture Binder. More... | |
Public Types | |
enum | Parameter : GLenum { Parameter::DepthStencilMode = GL_DEPTH_STENCIL_TEXTURE_MODE, Parameter::BaseLevel = GL_TEXTURE_BASE_LEVEL, Parameter::SwizzleR = GL_TEXTURE_SWIZZLE_R, Parameter::SwizzleG = GL_TEXTURE_SWIZZLE_G, Parameter::SwizzleB = GL_TEXTURE_SWIZZLE_B, Parameter::SwizzleA = GL_TEXTURE_SWIZZLE_A, 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 } |
enum | PixelType : GLenum { PixelType::UnsignedByte = GL_UNSIGNED_BYTE, PixelType::UnsignedShort565 = GL_UNSIGNED_SHORT_5_6_5, PixelType::UnsignedShort4444 = GL_UNSIGNED_SHORT_4_4_4_4, PixelType::UnsignedShort5551 = GL_UNSIGNED_SHORT_5_5_5_1 } |
Public Member Functions | |
Texture (PixelType pixelType=PixelType::UnsignedByte) | |
Texture (PixelType pixelType, GLuint handle) | |
Texture (const Texture &)=default | |
Texture (Texture &&)=default | |
Texture & | operator= (const Texture &)=default |
Texture & | operator= (Texture &&)=default |
virtual | ~Texture () |
virtual void | init () override |
Generates a OpenGL object name to manage. More... | |
virtual void | cleanup () override |
Deletes the managed OpenGL object. More... | |
virtual void | bind (unsigned int unit=0) const |
virtual void | unbind (unsigned int unit=0) const |
virtual bool | isValid () const override |
Returns true if the object seems valid. More... | |
template<typename T > | |
void | set (Parameter opt, T value) const |
template<typename T > | |
void | setI (Parameter opt, T value) const |
void | generateMipmaps () const |
virtual void | bindImage (GLuint unit, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format) const |
TODO. More... | |
virtual GLuint | getBound (unsigned int unit=0) const =0 |
virtual void | dump (const std::string &path) const |
Saves the texture as a png at path. 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 | |
OpenGLObject & | operator= (const OpenGLObject &)=default |
OpenGLObject & | operator= (OpenGLObject &&)=default |
virtual | ~OpenGLObject () |
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... | |
Static Public Member Functions | |
static void | activeUnit (unsigned int unit) |
Protected Member Functions | |
virtual GLenum | getType () const =0 |
Static Protected Member Functions | |
static bool | isTexture (GLuint name) |
static GLenum | getFormat (GLuint compCount) |
static GLuint | getCompCount (GLenum format) |
Protected Attributes | |
PixelType | _pixelType = PixelType::UnsignedByte |
Protected Attributes inherited from OpenGLObject | |
GLuint | _handle |
OpenGL name of the managed object. More... | |
Describes a texture living on the GPU's memory.
|
strong |
|
strong |
Texture::Texture | ( | PixelType | pixelType = PixelType::UnsignedByte | ) |
Texture::Texture | ( | PixelType | pixelType, |
GLuint | handle | ||
) |
|
default |
|
default |
|
virtual |
|
inlinestatic |
|
inlinevirtual |
|
virtual |
TODO.
|
overridevirtual |
Deletes the managed OpenGL object.
Implements OpenGLObject.
|
virtual |
Saves the texture as a png at path.
path | Path of the created file. |
Reimplemented in CubeMap.
void Texture::generateMipmaps | ( | ) | const |
|
pure virtual |
|
staticprotected |
|
staticprotected |
|
protectedpure virtual |
|
overridevirtual |
Generates a OpenGL object name to manage.
Implements OpenGLObject.
|
inlinestaticprotected |
|
inlineoverridevirtual |
Returns true if the object seems valid.
Can be overloaded for concrete types if there is other attributes to test.
Reimplemented from OpenGLObject.
|
inline |
|
inline |
|
inlinevirtual |
|
protected |