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

This class represents the Buffer class in GPU memory. More...

#include <Luminous/BufferGL.hpp>

Inheritance diagram for Luminous::BufferGL:
Luminous::ResourceHandleGL

Public Member Functions

LUMINOUS_API void bind (Buffer::Type type)
 Bind the buffer to the specified type. More...
 
LUMINOUS_API BufferGL (StateGL &state, const Buffer &buffer)
 Constructor. More...
 
LUMINOUS_API BufferGL (BufferGL &&t)
 Move constructor. More...
 
LUMINOUS_API void * map (Buffer::Type type, int offset, std::size_t length, Radiant::FlagsT< Buffer::MapAccess > access)
 Map a range of the buffer data store. More...
 
LUMINOUS_API BufferGLoperator= (BufferGL &&t)
 Move assignment operator. More...
 
LUMINOUS_API void unmap (Buffer::Type type, int offset=0, std::size_t length=std::size_t(-1))
 Unmaps a buffer range. More...
 
LUMINOUS_API void upload (const Buffer &buffer, Buffer::Type type)
 Specify buffer data. More...
 
LUMINOUS_API void upload (Buffer::Type type, int offset, std::size_t length, const void *data)
 Specify buffer data. More...
 
LUMINOUS_API ~BufferGL ()
 Destructor.
 
- Public Member Functions inherited from Luminous::ResourceHandleGL
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...
 

Additional Inherited Members

- Protected Attributes inherited from Luminous::ResourceHandleGL
GLuint m_handle
 Raw OpenGL handle of the resource.
 
StateGLm_state
 OpenGL state owned by the graphics driver.
 

Detailed Description

This class represents the Buffer class in GPU memory.

See Also
Buffer

Constructor & Destructor Documentation

LUMINOUS_API Luminous::BufferGL::BufferGL ( StateGL state,
const Buffer buffer 
)

Constructor.

Parameters
stateOpenGL state
bufferbuffer object in CPU memory
LUMINOUS_API Luminous::BufferGL::BufferGL ( BufferGL &&  t)

Move constructor.

Parameters
tbuffer to move

Member Function Documentation

LUMINOUS_API void Luminous::BufferGL::bind ( Buffer::Type  type)

Bind the buffer to the specified type.

Parameters
typetype to bind to
LUMINOUS_API void* Luminous::BufferGL::map ( Buffer::Type  type,
int  offset,
std::size_t  length,
Radiant::FlagsT< Buffer::MapAccess access 
)

Map a range of the buffer data store.

This functions maps the buffer address space to GPU. The contents of the buffer can then directly be read/written to relative to the returned pointer.

Parameters
typebuffer type
offsetoffset in bytes to start the mapping from
lengthnumber of bytes to map
accessaccess flags
LUMINOUS_API BufferGL& Luminous::BufferGL::operator= ( BufferGL &&  t)

Move assignment operator.

Parameters
tbuffer to move
LUMINOUS_API void Luminous::BufferGL::unmap ( Buffer::Type  type,
int  offset = 0,
std::size_t  length = std::size_t(-1) 
)

Unmaps a buffer range.

Parameters
typebuffer type
offsetoffset in bytes to start unmapping from
lengthnumber of bytes to unmap
LUMINOUS_API void Luminous::BufferGL::upload ( const Buffer buffer,
Buffer::Type  type 
)

Specify buffer data.

This function will upload the contents of the CPU buffer to GPU memory if needed.

Parameters
buffer
typebuffer type
LUMINOUS_API void Luminous::BufferGL::upload ( Buffer::Type  type,
int  offset,
std::size_t  length,
const void *  data 
)

Specify buffer data.

This function can be used to upload data to the GPU.

Parameters
typebuffer type
offsetoffset in bytes to start uploading from
lengthnumber of bytes to upload
datapointer to data to upload from