The Vish Visualization Shell 0.3
Vish
Classes | Public Member Functions | Static Public Member Functions | List of all members
Wizt::GLContextChecker Class Referenceabstract

This is a convenience class to check if an OpenGL context is currently active and available. More...

#include <ocean/GLvish/MetaGLViewerCreator.hpp>

Inheritance diagram for Wizt::GLContextChecker:
MemCore::ReferenceBase< GLContextChecker >

Classes

struct  ContextAvailable
 

Public Member Functions

virtual const void * CurrentGLContextID () const =0
 Get a an OpenGL context ID, which is useful to check if at this point of the code calling OpenGL functions is allowed.
 
- Public Member Functions inherited from MemCore::ReferenceBase< GLContextChecker >
auto getObjectCountID () const noexcept
 Get a unique ID for this object in the given domain.
 
bool isIdentical (const WeakPtr< GLContextChecker, GLContextChecker > &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 (GLContextChecker *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.
 

Static Public Member Functions

static int invalidContext ()
 

Additional Inherited Members

- Public Types inherited from MemCore::ReferenceBase< GLContextChecker >
using reference_domain_t = GLContextChecker
 The type of the base class.
 
using SelfPtr_t = WeakPtr< GLContextChecker, GLContextChecker >
 Type for a pointer to this object itself.
 
- Protected Member Functions inherited from MemCore::ReferenceBase< GLContextChecker >
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

This is a convenience class to check if an OpenGL context is currently active and available.

{
not good... no OpenGL context...
}
static int invalidContext()
Definition MetaGLViewerCreator.cpp:59

Member Function Documentation

◆ CurrentGLContextID()

virtual const void * Wizt::GLContextChecker::CurrentGLContextID ( ) const
pure virtual

Get a an OpenGL context ID, which is useful to check if at this point of the code calling OpenGL functions is allowed.

This is especcially useful for destructors of objects that clean up OpenGL objects. No explicit OpenGL context object is available then, but this function allows to check for validity. Such object may only be destroyed if there is a current OpenGL context, otherwise it will lead to runtime errors.

◆ invalidContext()

int Wizt::GLContextChecker::invalidContext ( )
static
Returns
Positive: There is no context. Zero: An OpenGL context is available and active. Negative: Context information could not be determined.

Referenced by Wizt::VBOCreator::release(), Wizt::GLTextureID::selectActiveTextureUnit(), Wizt::BufferArray::~BufferArray(), Wizt::GLTextureBase::~GLTextureBase(), Wizt::GLTextureID::~GLTextureID(), and Wizt::VBO::~VBO().