Open CASCADE Technology 7.8.0
|
Class implements OpenGL sampler object resource that stores the sampling parameters for a texture access. More...
#include <OpenGl_Sampler.hxx>
Public Member Functions | |
OpenGl_Sampler (const Handle< Graphic3d_TextureParams > &theParams) | |
Creates new sampler object. | |
virtual | ~OpenGl_Sampler () |
Releases resources of sampler object. | |
virtual void | Release (OpenGl_Context *theContext) override |
Destroys object - will release GPU memory if any. | |
virtual Standard_Size | EstimatedDataSize () const override |
Returns estimated GPU memory usage - not implemented. | |
Standard_Boolean | Create (const Handle< OpenGl_Context > &theContext) |
Creates an uninitialized sampler object. | |
Standard_Boolean | Init (const Handle< OpenGl_Context > &theContext, const OpenGl_Texture &theTexture) |
Creates and initializes sampler object. Existing object will be reused if possible, however if existing Sampler Object has Immutable flag and texture parameters should be re-initialized, then Sampler Object will be recreated. | |
Standard_Boolean | IsValid () const |
Returns true if current object was initialized. | |
void | Bind (const Handle< OpenGl_Context > &theCtx) |
Binds sampler object to texture unit specified in parameters. | |
void | Unbind (const Handle< OpenGl_Context > &theCtx) |
Unbinds sampler object from texture unit specified in parameters. | |
void | Bind (const Handle< OpenGl_Context > &theCtx, const Graphic3d_TextureUnit theUnit) |
Binds sampler object to the given texture unit. | |
void | Unbind (const Handle< OpenGl_Context > &theCtx, const Graphic3d_TextureUnit theUnit) |
Unbinds sampler object from the given texture unit. | |
void | SetParameter (const Handle< OpenGl_Context > &theCtx, unsigned int theTarget, unsigned int theParam, Standard_Integer theValue) |
Sets specific sampler parameter. | |
unsigned int | SamplerID () const |
Returns OpenGL sampler ID. | |
bool | IsImmutable () const |
Return immutable flag preventing further modifications of sampler parameters, FALSE by default. Immutable flag might be set when Sampler Object is used within Bindless Texture. | |
void | SetImmutable () |
Setup immutable flag. It is not possible unsetting this flag without Sampler destruction. | |
const Handle< Graphic3d_TextureParams > & | Parameters () |
Returns texture parameters. | |
void | SetParameters (const Handle< Graphic3d_TextureParams > &theParams) |
Sets texture parameters. | |
bool | ToUpdateParameters () const |
Returns texture parameters initialization state. | |
Public Member Functions inherited from OpenGl_Resource | |
OpenGl_Resource () | |
Empty constructor. | |
virtual | ~OpenGl_Resource () |
Destructor. Inheritors should call Clean (NULL) within it. | |
virtual void | DumpJson (Standard_OStream &theOStream, Standard_Integer theDepth=-1) const |
Dumps the content of me into the stream. | |
Public Member Functions inherited from Standard_Transient | |
Standard_Transient () | |
Empty constructor. | |
Standard_Transient (const Standard_Transient &) | |
Copy constructor – does nothing. | |
Standard_Transient & | operator= (const Standard_Transient &) |
Assignment operator, needed to avoid copying reference counter. | |
virtual | ~Standard_Transient () |
Destructor must be virtual. | |
virtual const opencascade::handle< Standard_Type > & | DynamicType () const |
Returns a type descriptor about this object. | |
Standard_Boolean | IsInstance (const opencascade::handle< Standard_Type > &theType) const |
Returns a true value if this is an instance of Type. | |
Standard_Boolean | IsInstance (const Standard_CString theTypeName) const |
Returns a true value if this is an instance of TypeName. | |
Standard_Boolean | IsKind (const opencascade::handle< Standard_Type > &theType) const |
Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism. | |
Standard_Boolean | IsKind (const Standard_CString theTypeName) const |
Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism. | |
Standard_Transient * | This () const |
Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero. | |
Standard_Integer | GetRefCount () const noexcept |
Get the reference counter of this object. | |
void | IncrementRefCounter () noexcept |
Increments the reference counter of this object. | |
Standard_Integer | DecrementRefCounter () noexcept |
Decrements the reference counter of this object; returns the decremented value. | |
virtual void | Delete () const |
Memory deallocator for transient classes. | |
Static Public Attributes | |
static const unsigned int | NO_SAMPLER = 0 |
Helpful constant defining invalid sampler identifier. | |
Protected Member Functions | |
Standard_Boolean | isValidSampler () const |
Checks if sampler object is valid. | |
Static Protected Member Functions | |
static void | setParameter (const Handle< OpenGl_Context > &theContext, OpenGl_Sampler *theSampler, unsigned int theTarget, unsigned int theParam, Standard_Integer theValue) |
Sets specific sampler parameter. | |
static void | applySamplerParams (const Handle< OpenGl_Context > &theCtx, const Handle< Graphic3d_TextureParams > &theParams, OpenGl_Sampler *theSampler, const unsigned int theTarget, const Standard_Integer theMaxMipLevel) |
Apply sampler parameters. | |
static void | applyGlobalTextureParams (const Handle< OpenGl_Context > &theCtx, const OpenGl_Texture &theTexture, const Handle< Graphic3d_TextureParams > &theParams) |
Apply global texture state for deprecated OpenGL functionality. | |
static void | resetGlobalTextureParams (const Handle< OpenGl_Context > &theCtx, const OpenGl_Texture &theTexture, const Handle< Graphic3d_TextureParams > &theParams) |
Reset global texture state for deprecated OpenGL functionality. | |
Protected Attributes | |
Handle< Graphic3d_TextureParams > | myParams |
texture parameters | |
unsigned int | mySamplerRevision |
modification counter of parameters related to sampler state | |
unsigned int | mySamplerID |
OpenGL sampler object ID. | |
bool | myIsImmutable |
immutable flag preventing further modifications of sampler parameters, FALSE by default | |
Additional Inherited Members | |
Public Types inherited from Standard_Transient | |
typedef void | base_type |
Returns a type descriptor about this object. | |
Static Public Member Functions inherited from Standard_Transient | |
static constexpr const char * | get_type_name () |
Returns a type descriptor about this object. | |
static const opencascade::handle< Standard_Type > & | get_type_descriptor () |
Returns type descriptor of Standard_Transient class. | |
Class implements OpenGL sampler object resource that stores the sampling parameters for a texture access.
OpenGl_Sampler::OpenGl_Sampler | ( | const Handle< Graphic3d_TextureParams > & | theParams | ) |
Creates new sampler object.
|
virtual |
Releases resources of sampler object.
|
staticprotected |
Apply global texture state for deprecated OpenGL functionality.
|
staticprotected |
Apply sampler parameters.
theCtx | [in] active OpenGL context |
theParams | [in] texture parameters to apply |
theSampler | [in] apply parameters to Texture object (NULL) or to specified Sampler object (non-NULL, sampler is not required to be bound) |
theTarget | [in] OpenGL texture target |
theMaxMipLevel | [in] maximum mipmap level defined within the texture |
|
inline |
Binds sampler object to texture unit specified in parameters.
void OpenGl_Sampler::Bind | ( | const Handle< OpenGl_Context > & | theCtx, |
const Graphic3d_TextureUnit | theUnit | ||
) |
Binds sampler object to the given texture unit.
Standard_Boolean OpenGl_Sampler::Create | ( | const Handle< OpenGl_Context > & | theContext | ) |
Creates an uninitialized sampler object.
|
inlineoverridevirtual |
Returns estimated GPU memory usage - not implemented.
Implements OpenGl_Resource.
Standard_Boolean OpenGl_Sampler::Init | ( | const Handle< OpenGl_Context > & | theContext, |
const OpenGl_Texture & | theTexture | ||
) |
Creates and initializes sampler object. Existing object will be reused if possible, however if existing Sampler Object has Immutable flag and texture parameters should be re-initialized, then Sampler Object will be recreated.
|
inline |
Return immutable flag preventing further modifications of sampler parameters, FALSE by default. Immutable flag might be set when Sampler Object is used within Bindless Texture.
|
inline |
Returns true if current object was initialized.
|
inlineprotected |
Checks if sampler object is valid.
|
inline |
Returns texture parameters.
|
overridevirtual |
Destroys object - will release GPU memory if any.
Implements OpenGl_Resource.
|
staticprotected |
Reset global texture state for deprecated OpenGL functionality.
|
inline |
Setup immutable flag. It is not possible unsetting this flag without Sampler destruction.
|
staticprotected |
Sets specific sampler parameter.
|
inline |
Sets specific sampler parameter.
void OpenGl_Sampler::SetParameters | ( | const Handle< Graphic3d_TextureParams > & | theParams | ) |
Sets texture parameters.
|
inline |
Returns texture parameters initialization state.
|
inline |
Unbinds sampler object from texture unit specified in parameters.
void OpenGl_Sampler::Unbind | ( | const Handle< OpenGl_Context > & | theCtx, |
const Graphic3d_TextureUnit | theUnit | ||
) |
Unbinds sampler object from the given texture unit.
|
protected |
immutable flag preventing further modifications of sampler parameters, FALSE by default
|
protected |
texture parameters
modification counter of parameters related to sampler state
Helpful constant defining invalid sampler identifier.