GL++  0.1
OpenGL API C++ Wrapper
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends Groups Pages
glpp::buffer Struct Reference

A general object for unformatted linear memory allocated by the OpenGL context. More...

#include <buffer.hpp>

Inheritance diagram for glpp::buffer:
glpp::named_object< GLuint > glpp::noncopyable

Public Member Functions

 buffer (buffer_type type)
 Construct an empty buffer object.
 ~buffer ()
 Destroy and release resources of buffer.
buffer_type type () const
 Get the defined target type that this buffer will be binded at.
void bind () const
 Bind this buffer to its defined target type.
void bind_to_point (GLuint point) const
 Bind base at specific index of arrayed targets (valid for some types)
void bind_to_point (GLuint point, size_t offset, size_t size) const
 Bind a range to specific index of arrayed targets (valid for some types)
size_t size () const
 The size of this buffer as defined by define_data()
void define_data (size_t size, const void *pdata, buffer_usage_pattern usage)
 Create and initializes a buffer object's data store.
void update_subdata (size_t offset, size_t size, const void *pdata)
 Create and initializes a buffer object's data store.
std::vector< uint8_t > get_data (size_t offset, size_t size)
 Get a subset of a buffer object's data store.
void * map_data (buffer_access_mode access)
 Map buffer's storage to host memory address.
bool unmap_data ()
 Unmap any previously mapped range.
void * map_data_range (size_t offset, size_t size, map_access_bit access)
 Map a range of buffer's storaget to host memory address.
void flush_mapped_range (size_t offset, size_t size)
 Indicate modifications to a range of a mapped buffer.
- Public Member Functions inherited from glpp::named_object< GLuint >
name_type object_name () const
 Return the name of object (handle)
- Public Member Functions inherited from glpp::noncopyable
 noncopyable (noncopyable &)
noncopyableoperator= (noncopyable &)

Protected Attributes

buffer_type m_buf_type
 Buffer target type.
size_t m_size
 Size of this buffer storage.
- Protected Attributes inherited from glpp::named_object< GLuint >
GLuint m_gl_name
 Stored object name.

Additional Inherited Members

- Public Types inherited from glpp::named_object< GLuint >
typedef GLuint name_type
 Type of the name.

Detailed Description

A general object for unformatted linear memory allocated by the OpenGL context.

Remarks
non-copyable, non-inheritable, RAII

Constructor & Destructor Documentation

glpp::buffer::buffer ( buffer_type  type)

Construct an empty buffer object.

http://www.opengl.org/sdk/docs/man4/xhtml/glGenBuffers.xml

Parameters
typeIs the target that this buffer will be used for.
glpp::buffer::~buffer ( )

Destroy and release resources of buffer.

http://www.opengl.org/sdk/docs/man4/xhtml/glDeleteBuffers.xml

Member Function Documentation

void glpp::buffer::bind ( ) const
inline

Bind this buffer to its defined target type.

See Also
buffer(buffer_type), type() http://www.opengl.org/sdk/docs/man4/xhtml/glBindBuffer.xml
void glpp::buffer::bind_to_point ( GLuint  point) const
inline

Bind base at specific index of arrayed targets (valid for some types)

http://www.opengl.org/sdk/docs/man4/xhtml/glBindBufferBase.xml

void glpp::buffer::bind_to_point ( GLuint  point,
size_t  offset,
size_t  size 
) const
inline

Bind a range to specific index of arrayed targets (valid for some types)

http://www.opengl.org/sdk/docs/man4/xhtml/glBindBufferRange.xml

void glpp::buffer::define_data ( size_t  size,
const void *  pdata,
buffer_usage_pattern  usage 
)

Create and initializes a buffer object's data store.

http://www.opengl.org/sdk/docs/man4/xhtml/glBufferData.xml

void glpp::buffer::flush_mapped_range ( size_t  offset,
size_t  size 
)

Indicate modifications to a range of a mapped buffer.

http://www.opengl.org/sdk/docs/man4/xhtml/glFlushMappedBufferRange.xml

std::vector< uint8_t > glpp::buffer::get_data ( size_t  offset,
size_t  size 
)

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

Remarks
You are adviced to prefer mapping instead of this technique. http://www.opengl.org/sdk/docs/man4/xhtml/glGetBufferSubData.xml
void * glpp::buffer::map_data ( buffer_access_mode  access)

Map buffer's storage to host memory address.

http://www.opengl.org/sdk/docs/man4/xhtml/glMapBuffer.xml

See Also
unmap_data(), map_data_range()
void * glpp::buffer::map_data_range ( size_t  offset,
size_t  size,
map_access_bit  access 
)

Map a range of buffer's storaget to host memory address.

http://www.opengl.org/sdk/docs/man4/xhtml/glMapBufferRange.xml

size_t glpp::buffer::size ( ) const
inline
buffer_type glpp::buffer::type ( ) const
inline

Get the defined target type that this buffer will be binded at.

See Also
bind()
bool glpp::buffer::unmap_data ( )

Unmap any previously mapped range.

Remarks
A mapped data store must be unmapped with glUnmapBuffer before its buffer object is used. Otherwise an error will be generated by any GL command that attempts to dereference the buffer object's data store.

http://www.opengl.org/sdk/docs/man4/xhtml/glMapBuffer.xml

See Also
map_data_range(), map_data()
void glpp::buffer::update_subdata ( size_t  offset,
size_t  size,
const void *  pdata 
)

Create and initializes a buffer object's data store.

http://www.opengl.org/sdk/docs/man4/xhtml/glBufferSubData.xml


The documentation for this struct was generated from the following files: