MeVisLab Toolbox Reference
GLResourceManager Class Reference

Manages OpenGL resources. More...

#include <mlGLResourceManager.h>

Classes

class  GLResourceList
 Dynamic list of GLResource objects. More...
 

Public Member Functions

 GLResourceManager ()
 
virtual ~GLResourceManager ()
 
bool isContextActive () const
 check if the current context is ac More...
 
void destroyTextures (int num, GLuint *textures)
 destroy the given texture ids (destroys them later if no GL context is currently active) More...
 
void destroyFragmentProgramARB (GLuint program)
 destroy the given fragment program id (destroys it later if no GL context is currently active) More...
 
void destroyRenderBuffer (GLuint id)
 destroy the given render buffer (destroys it later if no GL context is currently active) More...
 
void destroyFrameBuffer (GLuint id)
 destroy the given render buffer (destroys it later if no GL context is currently active) More...
 
void destroyBuffer (GLuint id)
 destroy the given vertex buffer (destroys it later if no GL context is currently active) More...
 
void destroyPixelBuffer (GLuint id)
 destroy the given pixel buffer (destroys it later if no GL context is currently active) More...
 
void destroyVertexBuffer (GLuint id)
 destroy the given pixel buffer (destroys it later if no GL context is currently active) More...
 
void destroyGLSLShader (GLuint id)
 destroy the given shader (destroys it later if no GL context is currently active) More...
 
void destroyGLSLProgram (GLuint id)
 destroy the given program (destroys it later if no GL context is currently active) More...
 
void destroyFTFont (FTFont *font)
 destroy the given font (destroys it later if no GL context is currently active) More...
 
void detachGLSLShader (GLuint program, GLuint shader)
 detach the given shader from the program (this is done later of the GL context is not currently active) More...
 
void disableGLSLProgram ()
 remove currently active program More...
 
void unlockContext (unsigned int cacheContextId)
 set that the context is active More...
 
void lockContext ()
 set that the context is locked More...
 
unsigned int cacheContextID ()
 get the current cache context id More...
 
GLenum getGLError () const
 check for OpenGL error (returns GL_INVALID_OPERATION if there is no valid OpenGL context) More...
 

Static Public Member Functions

static void init ()
 create singleton More...
 
static void cleanup ()
 destroy singleton More...
 
static GLResourceManagerself ()
 get singleton instance More...
 

Protected Types

typedef std::pair< GLuint, GLuint > GLSLProgramShaderPair
 

Protected Member Functions

void addResource (GLResource *program)
 add the given resource More...
 
void removeResource (GLResource *program)
 remove the given resource More...
 
void contextDestroyed ()
 forget about all resources, the shared context was destroyed More...
 
void freeResources ()
 free resources that could not be destroyed earlier More...
 
void add (GLResourceList &list, GLResource *resource)
 
void remove (GLResourceList &list, GLResource *resource)
 

Protected Attributes

bool _contextLocked
 
unsigned int _cacheContextID
 
GLResourceList _resources
 
std::vector< GLuint > _texturesToFree
 
std::vector< GLuint > _programsARBToFree
 
std::vector< GLuint > _frameBuffersToFree
 
std::vector< GLuint > _renderBuffersToFree
 
std::vector< GLuint > _buffersToFree
 
std::vector< GLuint > _GLSLProgramsToFree
 
std::vector< GLuint > _GLSLShadersToFree
 
std::vector< GLSLProgramShaderPair_GLSLShadersToDetach
 
std::vector< FTFont * > _FTFontsToFree
 

Static Protected Attributes

static GLResourceManager_self
 

Friends

class GLResource
 

Detailed Description

Manages OpenGL resources.

Definition at line 28 of file mlGLResourceManager.h.

Member Typedef Documentation

◆ GLSLProgramShaderPair

typedef std::pair<GLuint, GLuint> GLResourceManager::GLSLProgramShaderPair
protected

Definition at line 117 of file mlGLResourceManager.h.

Constructor & Destructor Documentation

◆ GLResourceManager()

GLResourceManager::GLResourceManager ( )

◆ ~GLResourceManager()

virtual GLResourceManager::~GLResourceManager ( )
virtual

Member Function Documentation

◆ add()

void GLResourceManager::add ( GLResourceList list,
GLResource resource 
)
protected

◆ addResource()

void GLResourceManager::addResource ( GLResource program)
protected

add the given resource

◆ cacheContextID()

unsigned int GLResourceManager::cacheContextID ( )
inline

get the current cache context id

Definition at line 80 of file mlGLResourceManager.h.

◆ cleanup()

static void GLResourceManager::cleanup ( )
static

destroy singleton

◆ contextDestroyed()

void GLResourceManager::contextDestroyed ( )
protected

forget about all resources, the shared context was destroyed

◆ destroyBuffer()

void GLResourceManager::destroyBuffer ( GLuint  id)

destroy the given vertex buffer (destroys it later if no GL context is currently active)

◆ destroyFragmentProgramARB()

void GLResourceManager::destroyFragmentProgramARB ( GLuint  program)

destroy the given fragment program id (destroys it later if no GL context is currently active)

◆ destroyFrameBuffer()

void GLResourceManager::destroyFrameBuffer ( GLuint  id)

destroy the given render buffer (destroys it later if no GL context is currently active)

◆ destroyFTFont()

void GLResourceManager::destroyFTFont ( FTFont *  font)

destroy the given font (destroys it later if no GL context is currently active)

◆ destroyGLSLProgram()

void GLResourceManager::destroyGLSLProgram ( GLuint  id)

destroy the given program (destroys it later if no GL context is currently active)

◆ destroyGLSLShader()

void GLResourceManager::destroyGLSLShader ( GLuint  id)

destroy the given shader (destroys it later if no GL context is currently active)

◆ destroyPixelBuffer()

void GLResourceManager::destroyPixelBuffer ( GLuint  id)
inline

destroy the given pixel buffer (destroys it later if no GL context is currently active)

Definition at line 57 of file mlGLResourceManager.h.

◆ destroyRenderBuffer()

void GLResourceManager::destroyRenderBuffer ( GLuint  id)

destroy the given render buffer (destroys it later if no GL context is currently active)

◆ destroyTextures()

void GLResourceManager::destroyTextures ( int  num,
GLuint *  textures 
)

destroy the given texture ids (destroys them later if no GL context is currently active)

◆ destroyVertexBuffer()

void GLResourceManager::destroyVertexBuffer ( GLuint  id)
inline

destroy the given pixel buffer (destroys it later if no GL context is currently active)

Definition at line 59 of file mlGLResourceManager.h.

◆ detachGLSLShader()

void GLResourceManager::detachGLSLShader ( GLuint  program,
GLuint  shader 
)

detach the given shader from the program (this is done later of the GL context is not currently active)

◆ disableGLSLProgram()

void GLResourceManager::disableGLSLProgram ( )

remove currently active program

◆ freeResources()

void GLResourceManager::freeResources ( )
protected

free resources that could not be destroyed earlier

◆ getGLError()

GLenum GLResourceManager::getGLError ( ) const

check for OpenGL error (returns GL_INVALID_OPERATION if there is no valid OpenGL context)

◆ init()

static void GLResourceManager::init ( )
static

create singleton

◆ isContextActive()

bool GLResourceManager::isContextActive ( ) const
inline

check if the current context is ac

Definition at line 44 of file mlGLResourceManager.h.

◆ lockContext()

void GLResourceManager::lockContext ( )

set that the context is locked

◆ remove()

void GLResourceManager::remove ( GLResourceList list,
GLResource resource 
)
protected

◆ removeResource()

void GLResourceManager::removeResource ( GLResource program)
protected

remove the given resource

◆ self()

static GLResourceManager* GLResourceManager::self ( )
inlinestatic

get singleton instance

Definition at line 41 of file mlGLResourceManager.h.

◆ unlockContext()

void GLResourceManager::unlockContext ( unsigned int  cacheContextId)

set that the context is active

Friends And Related Function Documentation

◆ GLResource

friend class GLResource
friend

Definition at line 110 of file mlGLResourceManager.h.

Member Data Documentation

◆ _buffersToFree

std::vector<GLuint> GLResourceManager::_buffersToFree
protected

Definition at line 123 of file mlGLResourceManager.h.

◆ _cacheContextID

unsigned int GLResourceManager::_cacheContextID
protected

Definition at line 113 of file mlGLResourceManager.h.

◆ _contextLocked

bool GLResourceManager::_contextLocked
protected

Definition at line 112 of file mlGLResourceManager.h.

◆ _frameBuffersToFree

std::vector<GLuint> GLResourceManager::_frameBuffersToFree
protected

Definition at line 121 of file mlGLResourceManager.h.

◆ _FTFontsToFree

std::vector<FTFont*> GLResourceManager::_FTFontsToFree
protected

Definition at line 127 of file mlGLResourceManager.h.

◆ _GLSLProgramsToFree

std::vector<GLuint> GLResourceManager::_GLSLProgramsToFree
protected

Definition at line 124 of file mlGLResourceManager.h.

◆ _GLSLShadersToDetach

std::vector<GLSLProgramShaderPair> GLResourceManager::_GLSLShadersToDetach
protected

Definition at line 126 of file mlGLResourceManager.h.

◆ _GLSLShadersToFree

std::vector<GLuint> GLResourceManager::_GLSLShadersToFree
protected

Definition at line 125 of file mlGLResourceManager.h.

◆ _programsARBToFree

std::vector<GLuint> GLResourceManager::_programsARBToFree
protected

Definition at line 120 of file mlGLResourceManager.h.

◆ _renderBuffersToFree

std::vector<GLuint> GLResourceManager::_renderBuffersToFree
protected

Definition at line 122 of file mlGLResourceManager.h.

◆ _resources

GLResourceList GLResourceManager::_resources
protected

Definition at line 115 of file mlGLResourceManager.h.

◆ _self

GLResourceManager* GLResourceManager::_self
staticprotected

Definition at line 129 of file mlGLResourceManager.h.

◆ _texturesToFree

std::vector<GLuint> GLResourceManager::_texturesToFree
protected

Definition at line 119 of file mlGLResourceManager.h.


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