All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Luminous::ResourceHandleGL Class Reference

Base class for all OpenGL resources that reside in GPU memory. More...

#include <Luminous/ResourceHandleGL.hpp>

Inheritance diagram for Luminous::ResourceHandleGL:
Luminous::BufferGL Luminous::FrameBufferGL Luminous::ProgramGL Luminous::RenderBufferGL Luminous::TextureGL Luminous::VertexArrayGL

Public Member Functions

bool expired () const
 Check if the resource has expired. More...
 
GLuint handle () const
 Get the raw OpenGL handle for the resource. More...
 
ResourceHandleGLoperator= (ResourceHandleGL &&r)
 Move assignment operator. More...
 
 ResourceHandleGL (StateGL &state)
 Constructor. More...
 
 ResourceHandleGL (ResourceHandleGL &&r)
 Move constructor. More...
 
void setExpirationSeconds (unsigned int secs)
 Set the expiration time in seconds for the resource. More...
 
void touch ()
 Update the last used timestamp to current frame-time. More...
 

Protected Attributes

GLuint m_handle
 Raw OpenGL handle of the resource.
 
StateGLm_state
 OpenGL state owned by the graphics driver.
 

Detailed Description

Base class for all OpenGL resources that reside in GPU memory.

Constructor & Destructor Documentation

Luminous::ResourceHandleGL::ResourceHandleGL ( StateGL state)
inline

Constructor.

Parameters
stateOpenGL state of the graphics driver
Luminous::ResourceHandleGL::ResourceHandleGL ( ResourceHandleGL &&  r)
inline

Move constructor.

Parameters
rresource handle to move

Member Function Documentation

bool Luminous::ResourceHandleGL::expired ( ) const
inline

Check if the resource has expired.

Resource is considered expired if the time since it was last accessed exceeds the defined expiration time. Expired resources are released by the graphics driver to conserve GPU memory.

See Also
setExpirationSeconds
touch
GLuint Luminous::ResourceHandleGL::handle ( ) const
inline

Get the raw OpenGL handle for the resource.

Returns
raw OpenGL handle
ResourceHandleGL & Luminous::ResourceHandleGL::operator= ( ResourceHandleGL &&  r)
inline

Move assignment operator.

Parameters
rresource handle to move
void Luminous::ResourceHandleGL::setExpirationSeconds ( unsigned int  secs)
inline

Set the expiration time in seconds for the resource.

Parameters
secsexpiration time in seconds
See Also
touch
expired
void Luminous::ResourceHandleGL::touch ( )
inline

Update the last used timestamp to current frame-time.

Every time the resource is accessed, this should be updated.

See Also
expired