ork::GPUBuffer Class Reference
[render]

A Buffer whose data is on the GPU. More...

#include <GPUBuffer.h>

Inheritance diagram for ork::GPUBuffer:
ork::Buffer ork::Object

List of all members.

Public Member Functions

 GPUBuffer ()
 Creates a new GPU buffer with no associated data.
virtual ~GPUBuffer ()
 Destroys this GPU buffer.
GLuint getId () const
 Returns the id of this buffer.
int getSize () const
 Returns the size of this buffer.
void setData (int size, const void *data, BufferUsage u)
 Sets the content of this buffer.
void setSubData (int target, int offset, int size, const void *data)
 Replaces a part of the content of this buffer.
void getSubData (int target, int offset, int size, void *data)
 Gets a part of the content of this buffer.
volatile void * map (BufferAccess a)
 Maps this buffer into CPU memory and returns a pointer to it.
volatile void * getMappedData ()
 Returns the mapped data of this buffer, or NULL if it is currently unmapped.
void unmap ()
 Unmaps this buffer from CPU memory.

Protected Member Functions

virtual void bind (int target) const
 Binds this buffer to the given target.
virtual void * data (int offset) const
 Returns (void*) offset.
virtual void unbind (int target) const
 Unbinds this buffer from the given target.

Detailed Description

A Buffer whose data is on the GPU.


Constructor & Destructor Documentation

ork::GPUBuffer::GPUBuffer (  ) 

Creates a new GPU buffer with no associated data.

virtual ork::GPUBuffer::~GPUBuffer (  )  [virtual]

Destroys this GPU buffer.

The buffer data itself is also destroyed.


Member Function Documentation

virtual void ork::GPUBuffer::bind ( int  target  )  const [protected, virtual]

Binds this buffer to the given target.

Parameters:
target an OpenGL buffer target (GL_ARRAY_BUFFER, etc).

Implements ork::Buffer.

virtual void* ork::GPUBuffer::data ( int  offset  )  const [protected, virtual]

Returns (void*) offset.

Implements ork::Buffer.

GLuint ork::GPUBuffer::getId (  )  const

Returns the id of this buffer.

volatile void* ork::GPUBuffer::getMappedData (  ) 

Returns the mapped data of this buffer, or NULL if it is currently unmapped.

int ork::GPUBuffer::getSize (  )  const

Returns the size of this buffer.

void ork::GPUBuffer::getSubData ( int  target,
int  offset,
int  size,
void *  data 
)

Gets a part of the content of this buffer.

Parameters:
target the target to bind to (use 0 for default).
offset index of the first byte to be replaced.
size number of bytes in 'data'.
data the new buffer data.
volatile void* ork::GPUBuffer::map ( BufferAccess  a  ) 

Maps this buffer into CPU memory and returns a pointer to it.

If the access mode is not READ_ONLY, changes made to the mapped buffer in CPU memory are reflected on GPU when the buffer is unmapped.

Parameters:
a the read and write permissions for this mapped memory region.
void ork::GPUBuffer::setData ( int  size,
const void *  data,
BufferUsage  u 
)

Sets the content of this buffer.

The previous content is erased and replaced by the new one.

Parameters:
size number of bytes in 'data'.
data the new buffer data. May be NULL.
u how this buffer will be used.
void ork::GPUBuffer::setSubData ( int  target,
int  offset,
int  size,
const void *  data 
)

Replaces a part of the content of this buffer.

Parameters:
target the target to bind to (use 0 for default).
offset index of the first byte to be replaced.
size number of bytes in 'data'.
data the new buffer data.
virtual void ork::GPUBuffer::unbind ( int  target  )  const [protected, virtual]

Unbinds this buffer from the given target.

Parameters:
target an OpenGL buffer target (GL_ARRAY_BUFFER, etc).

Implements ork::Buffer.

void ork::GPUBuffer::unmap (  ) 

Unmaps this buffer from CPU memory.


Generated on Mon Oct 18 09:36:09 2010 for ork by  doxygen 1.6.1