The Vish Visualization Shell 0.3
Vish
Public Member Functions | List of all members
Wizt::GLTexture2D Class Reference

Two-dimensional textures loaded from a dataset. More...

#include <ocean/GLvish/GLTexture2D.hpp>

Inheritance diagram for Wizt::GLTexture2D:
Wizt::GLTexture2DBase Wizt::EnableTexture Wizt::GLTexture< 2, 1 > Wizt::TextureID< N > Wizt::GLTextureBase Wizt::TextureBase MemCore::Cacheable MemCore::Ageable MemCore::Intercube MemCore::ReferenceBase< Cacheable >

Public Member Functions

 GLTexture2D (const MemCore::WeakPtr< MemCore::Creature > &C, int TextureUnit=0)
 Create 2D texture from data set.
 
 GLTexture2D (int TextureUnit=0)
 Create 2D texture on a given texture unit, not loading any data yet.
 
template<class DataType , typename glFormatType >
void load (const DataType *Data, GLsizei width, GLsizei height, GLenum format, const glFormatType &, GLint level=0)
 
template<class Type >
void load (const Type *Data, GLsizei width, GLsizei height, GLenum format)
 Simple call to load a 2D texture.
 
template<class Type , int internalformat>
void loadTexture (const Type *Data, GLsizei width, GLsizei height, GLenum format, const glMemSize< internalformat > &MS, GLint level, GLint border)
 
template<int internalformat>
void reserve (GLsizei width, GLsizei height, GLenum format, const glMemSize< internalformat > &MS, GLenum type, GLint level=0, GLint border=0)
 
 ~GLTexture2D ()
 Destructor, make sure it's only called with a valid OpenGL context.
 
- Public Member Functions inherited from Wizt::GLTexture2DBase
 GLTexture2DBase (int TextureTarget, const MemCore::WeakPtr< MemCore::Creature > &C, int TextureUnit=0)
 Create 2D texture from data set.
 
 GLTexture2DBase (int TextureTarget, int TextureUnit=0)
 Create 2D texture on a given texture unit, not loading any data yet.
 
GLuint height () const
 Return height of this texture, if one is loaded here.
 
GLuint width () const
 Return width of this texture, if one is loaded here.
 
- Public Member Functions inherited from Wizt::GLTexture< 2, 1 >
void bind (int i=0) const override
 Sets the active texture unit and calls glBindTexture() .
 
int BitsPerTexel () const
 return bits per texel, if known
 
 GLTexture (int TextureTarget, const MemCore::WeakPtr< MemCore::Creature > &C, int textureUnit=0)
 Creation of texture placeholder; does not need to be called from an OpenGL Context.
 
GLuint nElements (int n=0) const
 Return the number of texel elements stored in the nth texture.
 
void setTexParameters (int i=0) override
 Sets the texture parameters for the ith texture.
 
const GLuint * SizeAt (int i=0) const
 The dimension of this texture.
 
 ~GLTexture ()
 Destructor.
 
- Public Member Functions inherited from Wizt::TextureID< N >
void create_and_bind (int i=0)
 Possibly create a texture ID and bind it.
 
GLuint createID (int i=0)
 On first access, OpenGL textures will be generated. This function must be called from within a valid OpenGL context.
 
bool isValid () const
 Check whether a valid texture ID is stored here.
 
 operator bool () const
 Check whether a valid texture ID is stored here.
 
GLuint operator() (int i=0) const
 Read-only access to the stored texture ID's. This function will NOT call any texture ID's.
 
 TextureID (int TextureTarget, const MemCore::WeakPtr< MemCore::Creature > &C, GLenum textureUnit=0)
 The constructor does not yet create openGL textures yet. It is just a placeholder for deferred construction. Textures are created by the () access operator. As such, TextureID object can be created outside of an OpenGL context, but the access operator must be called within a valid one.
 
 ~TextureID ()
 Deletion of created OpenGL textures. Note that this destructor crashes if called outside a valid OpenGL context.
 
- Public Member Functions inherited from Wizt::GLTextureBase
void getTexLevelParameter (GLenum pname, GLint *params, int i=0, GLint level=0) const
 http://www.opengl.org/sdk/docs/man/xhtml/glGetTexLevelParameter.xml
 
 GLTextureBase (int TextureTarget, const MemCore::WeakPtr< MemCore::Creature > &C, int textureID=0) throw ()
 Constructor, specify texture unit (optional, by default 0)
 
void TexParameterf (GLenum pname, GLfloat param, int i=0)
 Sets an OpenGL texture parameter.
 
 ~GLTextureBase ()
 Destructor.
 
- Public Member Functions inherited from Wizt::TextureBase
int getTextureUnit () const
 Return the active texture unit selected here.
 
bool setActiveTexture (int textureID)
 Associate a texture unit with this texture ID which relates to glActiveTexture(), as to be invoked via activate().
 
 TextureBase (const MemCore::WeakPtr< MemCore::Creature > &C, int textureID=0) throw ()
 Constructor, specify texture unit (optional, by default 0)
 
virtual ~TextureBase ()
 Virtual Destructor.
 
- Public Member Functions inherited from MemCore::Cacheable
 Cacheable (const WeakPtr< Creature > &C)
 Constructor.
 
virtual void DeferredConstructor ()
 A virtual function that is called on the first strong referencing of a Cacheable object.
 
bool isCached () const
 Check whether this object is managed by a cache queue.
 
bool isUncached () const
 Check whether this object is managed by a cache queue.
 
bool markAsUsed ()
 Mark this data object as being recently used.
 
WeakPtr< CacheBasemyCache () const
 Return the associated Cache object as known from the associated Creator, if any.
 
const WeakPtr< Creature > & myCreator () const
 Return the associated Creator, if any.
 
int NumberOfListEntries () const
 Count the number of entries here.
 
void PreDestructor ()
 This class uses a predestructor to remove itself's size from the cache queue.
 
void push_back (CacheQueue &Q)
 Put the current item onto the BACK of the given cache queue.
 
void push_front (CacheQueue &Q)
 Put the current item onto the FRONT of the given cache queue.
 
void setCreator (const WeakPtr< Creature > &C)
 Set and the creator.
 
- Public Member Functions inherited from MemCore::ReferenceBase< Cacheable >
auto getObjectCountID () const noexcept
 Get a unique ID for this object in the given domain.
 
bool isIdentical (const WeakPtr< Cacheable, Cacheable > &PossibleSelf) const noexcept
 Check if this object is identical to the one used by the given pointer.
 
void mkAutoDestructive ()
 Marks this object as being automatically destructed, e.g.
 
refcount_t refcount () const noexcept
 The strong reference count.
 
 ReferenceBase (Cacheable *that) noexcept
 Constructor, initializes reference counter to zero.
 
const auto & self () const
 Return weak pointer to the object self.
 
refcount_t wrefcount () const noexcept
 The weak reference count.
 
- Public Member Functions inherited from MemCore::Ageable
 Ageable () noexcept
 Constructor; remembers birth time from current time counter.
 
constexpr Ageable (age_t t) noexcept
 Constructor with explicit time value.
 
constexpr Ageable (const Ageable &A) noexcept
 Copy constructor.
 
 Ageable (const volatile Ageable &A) noexcept
 Copy constructor.
 
constexpr const AgeablegetAge () const
 Return reference to this age, useful for derived classes.
 
bool isNewerThan (const Ageable &a) const noexcept
 Comparison operator.
 
bool isOlderThan (const Ageable &a) const noexcept
 Comparison operator.
 
bool isYoungerThan (const Ageable &a) const noexcept
 Comparison operator (alias to isNewerThan() )
 
bool operator!= (const Ageable &a) const noexcept
 Comparison operator.
 
bool operator< (const Ageable &a) const noexcept
 Comparison operator.
 
bool operator<= (const Ageable &a) const noexcept
 Comparision operator.
 
bool operator<= (const volatile Ageable &a) const volatile noexcept
 Comparision operator.
 
bool operator== (const Ageable &a) const noexcept
 Comparison operator.
 
bool operator> (const Ageable &a) const noexcept
 Comparison operator.
 
bool operator> (const volatile Ageable &a) const volatile throw ()
 Comparision operator.
 
bool operator>= (const Ageable &a) const noexcept
 Comparision operator.
 
bool operator>= (const volatile Ageable &a) const volatile noexcept
 Comparison operator.
 
constexpr void resetAge () noexcept
 Set time value to InfinitelyOld().
 
void setInfinitelyNew () noexcept
 Set time value to InfinitelyOld().
 
age_t time_value () const noexcept
 Return an object's current age.
 
age_t time_value () const volatile noexcept
 Return an object's current age.
 
Ageabletouch () noexcept
 Mark the current object as being modified "now".
 
age_t update (age_t age) noexcept
 Set the age of the current object to a specific age if that is newer than the current one.
 
age_t update (const Ageable &Other) noexcept
 Set the age of the current object to the age of another object if that other one is newer than the current one.
 
age_t update (const volatile Ageable &Other) volatile noexcept
 Set the age of the current object to the age of another object if that other one is newer than the current one.
 
 ~Ageable () noexcept
 Destructor.
 
- Public Member Functions inherited from MemCore::Intercube
void addInterface (const RefPtr< InterfaceBase > &I) const
 Add an interface class object.
 
template<class Data >
void addInterfaceData (const Data &D)
 Add data via an interface class object.
 
template<class Data , typename TypeSelector >
void addInterfaceData (const Data &D)
 Add data via an interface class object.
 
void clearInterfaces ()
 Remove all interfaces.
 
bool const_iterateInterfaces (const RefPtr< InterfaceIterationParameter > &IIP) const
 Constant iterator.
 
virtual RefPtr< InterfaceBasecreateInterface (const type_info &) const
 Virtual function which allows derived objects to create Interface objects on demand.
 
RefPtr< InterfaceBasefindInterface (const type_info &t) const
 Find a certain interface of specified type.
 
RefPtr< InterfaceBasegetInterface (const type_info &t)
 Retrieve an interface object from a certain type.
 
std::string getInterfaceNames (const char delim=';') const
 Debug function retrieving all interfaces as human-readable string.
 
template<class Data >
bool gotNewInterfaceData (const Data &D)
 Check whether data on the given interface have changed, and if so, set new data as interface.
 
template<class Data >
bool gotNewInterfaceData (mutex &M, const Data &D)
 Check whether interface data have changed, if so, then set new interface data and return true.
 
template<class Data , typename Selector >
bool gotNewInterfaceData (mutex &M, const Data &D)
 Check whether interface data have changed, if so, then set new interface data and return true.
 
template<class Data , typename Selector >
bool gotNewInterfaceData (mutex &M, const Data &D, const Selector &S)
 Check whether interface data have changed, if so, then set new interface data and return true.
 
template<class Data , typename Selector >
bool gotNewInterfaceData (mutex &M, const Data &D, const Selector *S)
 Check whether interface data have changed, if so, then set new interface data and return true.
 
template<class Data >
bool hasChangedInterfaceData (const Data &D) const
 Check whether interface data have changed.
 
template<class Data , typename Selector >
bool hasChangedInterfaceData (const Data &D) const
 Check whether interface data have changed.
 
template<class Data , typename Selector >
bool hasChangedInterfaceData (const Data &D, const Selector &) const
 Check whether interface data have changed.
 
template<class Data , typename Selector >
bool hasChangedInterfaceData (const Data &D, const Selector *) const
 Check whether interface data have changed.
 
bool hasInterface (const type_info &t) const
 Check if some Interface might exist.
 
 Intercube ()
 Constructor.
 
bool iterateInterfaces (const RefPtr< InterfaceIterationParameter > &IIP)
 Modifyable iterator.
 
void printInterfaces () const
 Debug function that prints the names of all interfaces.
 
void registerInterface (const type_info &t)
 Register an interface type; when the interface is actually required, the virtual createInterface() function will be called.
 
template<class InterfaceType >
void removeInterface ()
 Remove an interface.
 
void removeInterfaceBase (const type_info &InterfaceBaseID)
 Remove an interface.
 
virtual ~Intercube ()
 Destructor.
 
- Public Member Functions inherited from Wizt::EnableTexture
void disable () const
 Call glDisable()
 
void enable (int i=0)
 Call glEnable()
 

Additional Inherited Members

- Public Types inherited from MemCore::Cacheable
using cachecounter_t = unsigned long
 The type to store repeated accesses to a cached object.
 
- Public Types inherited from MemCore::ReferenceBase< Cacheable >
using reference_domain_t = Cacheable
 The type of the base class.
 
using SelfPtr_t = WeakPtr< Cacheable, Cacheable >
 Type for a pointer to this object itself.
 
- Static Public Member Functions inherited from MemCore::Ageable
static const AgeableInfinitelyNew () noexcept
 Return a time that is infinitely in the future (well, sort of).
 
static constexpr const AgeableInfinitelyOld () noexcept
 Return a time that is infinitely in the past (well, sort of).
 
static age_t now () noexcept
 Return the current global time.
 
- Public Attributes inherited from Wizt::GLTexture< 2, 1 >
GLenum TextureMaxFilter [N]
 Texture max filter, set to GL_LINEAR initially Set by setTexParameters().
 
GLenum TextureMinFilter [N]
 Texture min filter, set to GL_NEAREST initially. Set by setTexParameters().
 
Eagle::Vector< double, Dims > TextureOffset [N]
 Offset for texture coordinates.
 
Eagle::Vector< double, Dims > TextureScale [N]
 For each texture stored here, provide some scaling info on the fractional part that is utilized here.
 
GLenum TextureWrap [N][Dims]
 Texture wrap parameter, for each texture and texture coordinates.
 
- Public Attributes inherited from Wizt::GLTextureBase
const int target
 The corresponding OpenGL texture target (GL_TEXTURE_nD)
 
- Protected Member Functions inherited from Wizt::GLTexture< 2, 1 >
void setTexParametersNoBind (int i=0) const
 Sets the texture parameters for the ith texture, but doesn't call bind() before.
 
- Protected Member Functions inherited from Wizt::GLTextureBase
bool SelectActiveTextureUnit () const
 Activate the associated texture unit Return false if run with an OpenGL version that does not support multiple texture units (pre 2.0) Calls glActiveTexture.
 
- Protected Member Functions inherited from MemCore::Cacheable
void adjustCacheableSize (memsize_t memDiff)
 In case this object changes its size after insertion to the CacheQueue, call this function to adjust.
 
 ~Cacheable ()
 Destructor.
 
- Protected Member Functions inherited from MemCore::ReferenceBase< Cacheable >
virtual void extremeUnction ()
 A virtual function that will be called just before the object is destroyed.
 
ReferenceBaseoperator= (const ReferenceBase &R)
 Protected assignment operator (should not be called).
 
void suicide ()
 Delete this.
 
virtual ~ReferenceBase ()
 Virtual destructor.
 

Detailed Description

Two-dimensional textures loaded from a dataset.

Member Function Documentation

◆ load() [1/2]

template<class DataType , typename glFormatType >
void Wizt::GLTexture2D::load ( const DataType *  Data,
GLsizei  width,
GLsizei  height,
GLenum  format,
const glFormatType &  ,
GLint  level = 0 
)
inline
Parameters
formatGL_RED, GL_RG, GL_RGB, GL_BGR, GL_RGBA, and GL_BGRA.

◆ load() [2/2]

template<class Type >
void Wizt::GLTexture2D::load ( const Type *  Data,
GLsizei  width,
GLsizei  height,
GLenum  format 
)
inline

Simple call to load a 2D texture.

Parameters
formatSpecifies the format of the pixel data. The following symbolic values are accepted: GL_COLOR_INDEX, GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA, GL_RGB, GL_BGR GL_RGBA, GL_BGRA, GL_LUMINANCE, and GL_LUMINANCE_ALPHA.

◆ loadTexture()

template<class Type , int internalformat>
void Wizt::GLTexture2D::loadTexture ( const Type *  Data,
GLsizei  width,
GLsizei  height,
GLenum  format,
const glMemSize< internalformat > &  MS,
GLint  level,
GLint  border 
)
inline
Parameters
formatSpecifies the format of the pixel data. The following symbolic values are accepted: GL_COLOR_INDEX, GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA, GL_RGB, GL_BGR GL_RGBA, GL_BGRA, GL_LUMINANCE, and GL_LUMINANCE_ALPHA.
internalFormatSpecifies the number of color components in the texture. Must be 1, 2, 3, or 4, or one of the following symbolic constants: GL_ALPHA, GL_ALPHA4, GL_ALPHA8, GL_ALPHA12, GL_ALPHA16, GL_LUMINANCE, GL_LUMINANCE4, GL_LUMINANCE8, GL_LUMINANCE12, GL_LUMINANCE16, GL_LUMINANCE_ALPHA, GL_LUMINANCE4_ALPHA4, GL_LUMINANCE6_ALPHA2, GL_LUMINANCE8_ALPHA8, GL_LUMINANCE12_ALPHA4, GL_LUMINANCE12_ALPHA12, GL_LUMINANCE16_ALPHA16, GL_INTENSITY, GL_INTENSITY4, GL_INTENSITY8, GL_INTENSITY12, GL_INTENSITY16, GL_R3_G3_B2, GL_RGB, GL_RGB4, GL_RGB5, GL_RGB8, GL_RGB10, GL_RGB12, GL_RGB16, GL_RGBA, GL_RGBA2, GL_RGBA4, GL_RGB5_A1, GL_RGBA8, GL_RGB10_A2, GL_RGBA12, or GL_RGBA16.

◆ reserve()

template<int internalformat>
void Wizt::GLTexture2D::reserve ( GLsizei  width,
GLsizei  height,
GLenum  format,
const glMemSize< internalformat > &  MS,
GLenum  type,
GLint  level = 0,
GLint  border = 0 
)
inline
Parameters
formatSpecifies the format of the pixel data. The following symbolic values are accepted: GL_COLOR_INDEX, GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA, GL_RGB, GL_BGR GL_RGBA, GL_BGRA, GL_LUMINANCE, and GL_LUMINANCE_ALPHA.
internalFormatSpecifies the number of color components in the texture. Must be 1, 2, 3, or 4, or one of the following symbolic constants: GL_ALPHA, GL_ALPHA4, GL_ALPHA8, GL_ALPHA12, GL_ALPHA16, GL_LUMINANCE, GL_LUMINANCE4, GL_LUMINANCE8, GL_LUMINANCE12, GL_LUMINANCE16, GL_LUMINANCE_ALPHA, GL_LUMINANCE4_ALPHA4, GL_LUMINANCE6_ALPHA2, GL_LUMINANCE8_ALPHA8, GL_LUMINANCE12_ALPHA4, GL_LUMINANCE12_ALPHA12, GL_LUMINANCE16_ALPHA16, GL_INTENSITY, GL_INTENSITY4, GL_INTENSITY8, GL_INTENSITY12, GL_INTENSITY16, GL_R3_G3_B2, GL_RGB, GL_RGB4, GL_RGB5, GL_RGB8, GL_RGB10, GL_RGB12, GL_RGB16, GL_RGBA, GL_RGBA2, GL_RGBA4, GL_RGB5_A1, GL_RGBA8, GL_RGB10_A2, GL_RGBA12, or GL_RGBA16.
Note
Calls glTexImage2D() with a NULL pointer as the data section.