13#ifndef ML_GLRESOURCE_MANAGER_H
14#define ML_GLRESOURCE_MANAGER_H
Dynamic list of GLResource objects.
Manages OpenGL resources.
std::vector< GLuint > _buffersToFree
bool isContextActive() const
check if the current context is ac
GLResourceList _resources
std::pair< GLuint, GLuint > GLSLProgramShaderPair
void destroyFragmentProgramARB(GLuint program)
destroy the given fragment program id (destroys it later if no GL context is currently active)
virtual ~GLResourceManager()
void destroyGLSLProgram(GLuint id)
destroy the given program (destroys it later if no GL context is currently active)
std::vector< GLuint > _GLSLShadersToFree
static GLResourceManager * _self
void destroyVertexBuffer(GLuint id)
destroy the given pixel buffer (destroys it later if no GL context is currently active)
void freeResources()
free resources that could not be destroyed earlier
std::vector< FTFont * > _FTFontsToFree
GLenum getGLError() const
check for OpenGL error (returns GL_INVALID_OPERATION if there is no valid OpenGL context)
void destroyBuffer(GLuint id)
destroy the given vertex buffer (destroys it later if no GL context is currently active)
std::vector< GLuint > _renderBuffersToFree
void destroyFrameBuffer(GLuint id)
destroy the given render buffer (destroys it later if no GL context is currently active)
void add(GLResourceList &list, GLResource *resource)
void remove(GLResourceList &list, GLResource *resource)
static GLResourceManager * self()
get singleton instance
std::vector< GLuint > _GLSLProgramsToFree
static void cleanup()
destroy singleton
void contextDestroyed()
forget about all resources, the shared context was destroyed
void lockContext()
set that the context is locked
void destroyPixelBuffer(GLuint id)
destroy the given pixel buffer (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)
unsigned int cacheContextID()
get the current cache context id
std::vector< GLuint > _programsARBToFree
void unlockContext(unsigned int cacheContextId)
set that the context is active
std::vector< GLuint > _frameBuffersToFree
unsigned int _cacheContextID
std::vector< GLuint > _texturesToFree
void disableGLSLProgram()
remove currently active program
void addResource(GLResource *program)
add the given resource
std::vector< GLSLProgramShaderPair > _GLSLShadersToDetach
void destroyTextures(int num, GLuint *textures)
destroy the given texture ids (destroys them 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 removeResource(GLResource *program)
remove the given resource
void detachGLSLShader(GLuint program, GLuint shader)
detach the given shader from the program (this is done later of the GL context is not currently activ...
void destroyRenderBuffer(GLuint id)
destroy the given render buffer (destroys it later if no GL context is currently active)
static void init()
create singleton
Collection of OpenGL related resource classes, such as textures, buffers, fragment programs etc.
#define ML_OPENGL_END_NAMESPACE
Closes the namespace for all ML stuff after the usage of ML_UTILS_START_NAMESPACE.
#define ML_OPENGL_START_NAMESPACE
Macro to put all following stuff into the namespace ML_NAMESPACE to avoid collisions with symbols of ...
Target mlrange_cast(Source arg)
Generic version of checked ML casts.