MeVisLabToolboxReference
GLResourceManager Class Reference

Manages OpenGL resources. More...

#include <mlGLResourceManager.h>

List of all members.

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
void destroyTextures (int num, GLuint *textures)
 destroy the given texture ids (destroys them later if no GL context is currently active)
void destroyFragmentProgramARB (GLuint program)
 destroy the given fragment program id (destroys it later if no GL context is currently active)
void destroyRenderBuffer (GLuint id)
 destroy the given render buffer (destroys it later if no GL context is currently active)
void destroyFrameBuffer (GLuint id)
 destroy the given render buffer (destroys it later if no GL context is currently active)
void destroyVertexBuffer (GLuint id)
 destroy the given vertex buffer (destroys it later if no GL context is currently active)
void destroyPixelBuffer (GLuint id)
 destroy the given pixel buffer (destroys it later if no GL context is currently active)
void destroyDisplayList (GLuint id)
 destroy the given display list (destroys it later if no GL context is currently active)
void destroyGLSLShader (GLuint id)
 destroy the given shader (destroys it later if no GL context is currently active)
void destroyGLSLProgram (GLuint id)
 destroy the given program (destroys it later if no GL context is currently active)
void destroyFTFont (FTFont *font)
 destroy the given font (destroys it later if no GL context is currently active)
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)
void disableGLSLProgram ()
 remove currently active program
void unlockContext (unsigned int cacheContextId)
 set that the context is active
void lockContext ()
 set that the context is locked
unsigned int cacheContextID ()
 get the current cache context id
GLenum getGLError () const
 check for OpenGL error (returns GL_INVALID_OPERATION if there is no valid OpenGL context)

Static Public Member Functions

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

Protected Types

typedef std::pair< GLuint, GLuint > GLSLProgramShaderPair

Protected Member Functions

void addResource (GLResource *program)
 add the given resource
void removeResource (GLResource *program)
 remove the given resource
void contextDestroyed ()
 forget about all resources, the shared context was destroyed
void freeResources ()
 free resources that could not be destroyed earlier
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 > _vertexBuffersToFree
std::vector< GLuint > _pixelBuffersToFree
std::vector< GLuint > _displayListsToFree
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 24 of file mlGLResourceManager.h.


Member Typedef Documentation

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

Definition at line 113 of file mlGLResourceManager.h.


Constructor & Destructor Documentation

GLResourceManager::GLResourceManager ( )
virtual GLResourceManager::~GLResourceManager ( ) [virtual]

Member Function Documentation

void GLResourceManager::add ( GLResourceList list,
GLResource resource 
) [protected]
void GLResourceManager::addResource ( GLResource program) [protected]

add the given resource

unsigned int GLResourceManager::cacheContextID ( ) [inline]

get the current cache context id

Definition at line 76 of file mlGLResourceManager.h.

static void GLResourceManager::cleanup ( ) [static]

destroy singleton

void GLResourceManager::contextDestroyed ( ) [protected]

forget about all resources, the shared context was destroyed

void GLResourceManager::destroyDisplayList ( GLuint  id)

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

void GLResourceManager::destroyFragmentProgramARB ( GLuint  program)

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

void GLResourceManager::destroyFrameBuffer ( GLuint  id)

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

void GLResourceManager::destroyFTFont ( FTFont *  font)

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

void GLResourceManager::destroyGLSLProgram ( GLuint  id)

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

void GLResourceManager::destroyGLSLShader ( GLuint  id)

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

void GLResourceManager::destroyPixelBuffer ( GLuint  id)

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

void GLResourceManager::destroyRenderBuffer ( GLuint  id)

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

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

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

void GLResourceManager::destroyVertexBuffer ( GLuint  id)

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

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)

void GLResourceManager::disableGLSLProgram ( )

remove currently active program

void GLResourceManager::freeResources ( ) [protected]

free resources that could not be destroyed earlier

GLenum GLResourceManager::getGLError ( ) const

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

static void GLResourceManager::init ( ) [static]

create singleton

bool GLResourceManager::isContextActive ( ) const [inline]

check if the current context is ac

Definition at line 40 of file mlGLResourceManager.h.

void GLResourceManager::lockContext ( )

set that the context is locked

void GLResourceManager::remove ( GLResourceList list,
GLResource resource 
) [protected]
void GLResourceManager::removeResource ( GLResource program) [protected]

remove the given resource

static GLResourceManager* GLResourceManager::self ( ) [inline, static]

get singleton instance

Definition at line 37 of file mlGLResourceManager.h.

void GLResourceManager::unlockContext ( unsigned int  cacheContextId)

set that the context is active


Friends And Related Function Documentation

friend class GLResource [friend]

Definition at line 106 of file mlGLResourceManager.h.


Member Data Documentation

unsigned int GLResourceManager::_cacheContextID [protected]

Definition at line 109 of file mlGLResourceManager.h.

Definition at line 108 of file mlGLResourceManager.h.

std::vector<GLuint> GLResourceManager::_displayListsToFree [protected]

Definition at line 121 of file mlGLResourceManager.h.

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

Definition at line 117 of file mlGLResourceManager.h.

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

Definition at line 125 of file mlGLResourceManager.h.

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

Definition at line 122 of file mlGLResourceManager.h.

Definition at line 124 of file mlGLResourceManager.h.

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

Definition at line 123 of file mlGLResourceManager.h.

std::vector<GLuint> GLResourceManager::_pixelBuffersToFree [protected]

Definition at line 120 of file mlGLResourceManager.h.

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

Definition at line 116 of file mlGLResourceManager.h.

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

Definition at line 118 of file mlGLResourceManager.h.

Definition at line 111 of file mlGLResourceManager.h.

Definition at line 127 of file mlGLResourceManager.h.

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

Definition at line 115 of file mlGLResourceManager.h.

std::vector<GLuint> GLResourceManager::_vertexBuffersToFree [protected]

Definition at line 119 of file mlGLResourceManager.h.


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