class ffw::GLBuffer

Class List > ffw :: GLBuffer

Inherited by the following classes: ffw::GLElementBuffer, ffw::GLVertexBuffer

Protected Attributes

Type Name
GLenum accesstype
GLenum buffertype
bool loaded
GLuint buffer
GLsizei size

Public Functions

Type Name
GLBuffer ()
Creates an empty OpenGL buffer object.
GLBuffer (GLenum buffertype, const GLvoid * data, GLsizei size, GLenum type)
Creates an OpenGL buffer object with specific target type.
GLBuffer (const GLBuffer & other) = delete
GLBuffer (GLBuffer && other)
void swap (GLBuffer & other)
virtual ~GLBuffer ()
bool isCreated () const
Returns true if the object has been allocated.
void resize (const GLvoid * data, GLsizei size)
Resizes the buffer and copies the data.
void setData (const GLvoid * data, GLsizei offset, GLsizei size)
Updates a subset of the buffer with data.
void mapBuffer (GLvoid ** pointer, GLenum access) const
Map all of a buffer object's data store into the client's address space.
void mapBufferRange (GLvoid ** pointer, GLsizei offset, GLsizei size, GLenum access) const
Map all or part of a buffer object's data store into the client's address space.
void flushMappedBufferRange (GLsizei offset, GLsizei size) const
Indicate modifications to a range of a mapped buffer.
void unMapBuffer () const
Release the mapping of a buffer object's data store into the client's address space.
void destroy ()
Releases the resources.
void bind () const
Binds the buffer object.
void unbind () const
Unbinds the buffer object and sets the current buffer object to zero.
GLuint getHandle () const
Returns the OpenGL named object (the handle)
GLsizei getSize () const
Returns the size of the buffer in bytes.
GLenum getAccessType () const
Returns the access type of the buffer as GL_READ_ONLY, GL_WRITE_ONLY, or GL_READ_WRITE.
GLenum getBufferType () const
Returns the object type of the buffer specified during the constructor.
void copyFrom (const GLBuffer * other, GLintptr readoffset, GLintptr writeoffset, GLsizeiptr size)
Copy all or part of the data store of a buffer object to the data store of another buffer object.
void getData (GLvoid * data, GLsizei offset, GLsizei size)
Reads a subset of a buffer object's data store.
std::vector< uint8_t > getData (GLsizei offset, GLsizei size)
Returns a subset of a buffer object's data store.
GLBuffer & operator= (const GLBuffer & other) = delete
GLBuffer & operator= (GLBuffer && other)

Protected Attributes Documentation

variable accesstype

GLenum ffw::GLBuffer::accesstype;

variable buffertype

GLenum ffw::GLBuffer::buffertype;

variable loaded

bool ffw::GLBuffer::loaded;

variable buffer

GLuint ffw::GLBuffer::buffer;

variable size

GLsizei ffw::GLBuffer::size;

Public Functions Documentation

function GLBuffer (1/4)

ffw::GLBuffer::GLBuffer ()

Creates an empty OpenGL buffer object.

function GLBuffer (2/4)

ffw::GLBuffer::GLBuffer (
    GLenum buffertype,
    const GLvoid * data,
    GLsizei size,
    GLenum type
)

Creates an OpenGL buffer object with specific target type.

Parameters:

  • buffertype Allowed values are GL_ARRAY_BUFFER, GL_ATOMIC_COUNTER_BUFFER, GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, GL_DISPATCH_INDIRECT_BUFFER, GL_DRAW_INDIRECT_BUFFER, GL_ELEMENT_ARRAY_BUFFER, GL_PIXEL_PACK_BUFFER, GL_PIXEL_UNPACK_BUFFER, GL_QUERY_BUFFER, GL_SHADER_STORAGE_BUFFER, GL_TEXTURE_BUFFER, GL_TRANSFORM_FEEDBACK_BUFFER, or GL_UNIFORM_BUFFER
  • data Specifies a pointer to data that will be copied into the data store for initialization, or NULL if no data is to be copied.
  • size Specifies the size in bytes of the buffer object's new data store.
  • type Specifies the expected usage pattern of the data store. The symbolic constant must be GL_STREAM_DRAW, GL_STREAM_READ, GL_STREAM_COPY, GL_STATIC_DRAW, GL_STATIC_READ, GL_STATIC_COPY, GL_DYNAMIC_DRAW, GL_DYNAMIC_READ, or GL_DYNAMIC_COPY.

Exception:

function GLBuffer (3/4)

ffw::GLBuffer::GLBuffer (
    const GLBuffer & other
) = delete

function GLBuffer (4/4)

ffw::GLBuffer::GLBuffer (
    GLBuffer && other
)

function swap

void ffw::GLBuffer::swap (
    GLBuffer & other
)

function ~GLBuffer

virtual ffw::GLBuffer::~GLBuffer ()

function isCreated

bool ffw::GLBuffer::isCreated () const

Returns true if the object has been allocated.

function resize

void ffw::GLBuffer::resize (
    const GLvoid * data,
    GLsizei size
)

Resizes the buffer and copies the data.

Parameters:

  • data Specifies a pointer to data that will be copied into the data store for initialization, or NULL if no data is to be copied.
  • size Specifies the size in bytes of the buffer object's new data store.

Exception:

  • GLException if buffer is not created or if the buffer re-allocation failed

function setData

void ffw::GLBuffer::setData (
    const GLvoid * data,
    GLsizei offset,
    GLsizei size
)

Updates a subset of the buffer with data.

Parameters:

  • data Specifies a pointer to the new data that will be copied into the data store.
  • offset Specifies the offset into the buffer object's data store where data replacement will begin, measured in bytes.
  • size Specifies the size in bytes of the data store region being replaced.

Exception:

function mapBuffer

void ffw::GLBuffer::mapBuffer (
    GLvoid ** pointer,
    GLenum access
) const

Map all of a buffer object's data store into the client's address space.

Parameters:

  • pointer Pointer to the client space address. The data can then be directly read and/or written relative to the pointer.
  • access Specifies the access policy for glMapBuffer and glMapNamedBuffer, indicating whether it will be possible to read from, write to, or both read from and write to the buffer object's mapped data store. The symbolic constant must be GL_READ_ONLY, GL_WRITE_ONLY, or GL_READ_WRITE.

Exception:

function mapBufferRange

void ffw::GLBuffer::mapBufferRange (
    GLvoid ** pointer,
    GLsizei offset,
    GLsizei size,
    GLenum access
) const

Map all or part of a buffer object's data store into the client's address space.

Parameters:

  • pointer Pointer to the client space address. The data can then be directly read and/or written relative to the pointer.
  • offset Specifies the starting offset within the buffer of the range to be mapped.
  • size Specifies the length of the range to be mapped.
  • access Specifies the access policy for glMapBuffer and glMapNamedBuffer, indicating whether it will be possible to read from, write to, or both read from and write to the buffer object's mapped data store. The symbolic constant must be GL_READ_ONLY, GL_WRITE_ONLY, or GL_READ_WRITE.

Exception:

function flushMappedBufferRange

void ffw::GLBuffer::flushMappedBufferRange (
    GLsizei offset,
    GLsizei size
) const

Indicate modifications to a range of a mapped buffer.

Parameters:

  • offset Specifies the start of the buffer subrange, in bytes.
  • size Specifies the length of the buffer subrange, in bytes.

Exception:

function unMapBuffer

void ffw::GLBuffer::unMapBuffer () const

Release the mapping of a buffer object's data store into the client's address space.

Exception:

function destroy

void ffw::GLBuffer::destroy ()

Releases the resources.

function bind

void ffw::GLBuffer::bind () const

Binds the buffer object.

function unbind

void ffw::GLBuffer::unbind () const

Unbinds the buffer object and sets the current buffer object to zero.

function getHandle

GLuint ffw::GLBuffer::getHandle () const

Returns the OpenGL named object (the handle)

function getSize

GLsizei ffw::GLBuffer::getSize () const

Returns the size of the buffer in bytes.

function getAccessType

GLenum ffw::GLBuffer::getAccessType () const

Returns the access type of the buffer as GL_READ_ONLY, GL_WRITE_ONLY, or GL_READ_WRITE.

function getBufferType

GLenum ffw::GLBuffer::getBufferType () const

Returns the object type of the buffer specified during the constructor.

function copyFrom

void ffw::GLBuffer::copyFrom (
    const GLBuffer * other,
    GLintptr readoffset,
    GLintptr writeoffset,
    GLsizeiptr size
)

Copy all or part of the data store of a buffer object to the data store of another buffer object.

Parameters:

  • other The other source object to copy data from
  • readoffset Specifies the offset, in bytes, within the data store of the source buffer object at which data will be read.
  • writeoffset Specifies the offset, in bytes, within the data store of the destination buffer object at which data will be written.
  • size Specifies the size, in bytes, of the data to be copied from the source buffer object to the destination buffer object.

Exception:

  • GLException if buffer is not created or if the other buffer is invalid

function getData (1/2)

void ffw::GLBuffer::getData (
    GLvoid * data,
    GLsizei offset,
    GLsizei size
)

Reads a subset of a buffer object's data store.

Parameters:

  • data Specifies a pointer to the location where buffer object data is returned.
  • offset Specifies the offset into the buffer object's data store from which data will be returned, measured in bytes.
  • size Specifies the size in bytes of the data store region being returned.

Exception:

function getData (2/2)

std::vector< uint8_t > ffw::GLBuffer::getData (
    GLsizei offset,
    GLsizei size
)

Returns a subset of a buffer object's data store.

Parameters:

  • offset Specifies the offset into the buffer object's data store from which data will be returned, measured in bytes.
  • size Specifies the size in bytes of the data store region being returned.

Returns:

a vector of uint8_t

Exception:

function operator= (1/2)

GLBuffer & ffw::GLBuffer::operator= (
    const GLBuffer & other
) = delete

function operator= (2/2)

GLBuffer & ffw::GLBuffer::operator= (
    GLBuffer && other
)

The documentation for this class was generated from the following file: include/ffw/graphics/glbuffer.h