OGLplus (0.45.0) a C++ wrapper for OpenGL

An OGLplus object encapsulating the OpenGL buffer functionality. More...

#include </home/chochlik/devel/oglplus/include/oglplus/buffer.hpp>

Inheritance diagram for oglplus::Buffer:
Collaboration diagram for oglplus::Buffer:

Public Types

typedef BufferTarget Target
 Buffer bind targets.
 
typedef BufferIndexedTarget IndexedTarget
 Buffer indexed bind targets.
 
typedef BufferTypedMap< GLubyte > Map
 Mapping of the buffer to the client address space.
 

Public Member Functions

void Bind (Target target) const
 Bind this buffer to the specified target. More...
 
void Bind (IndexedTarget target, GLuint index) const
 Bind this buffer to the specified indexed target. More...
 
void BindBase (IndexedTarget target, GLuint index) const
 Bind this buffer to the specified indexed target. More...
 
void BindBaseUniform (UniformBufferBindingPoint index) const
 Bind this buffer to the specified uniform buffer binding point. More...
 
void BindBaseTransformFeedback (TransformFeedbackBufferBindingPoint index) const
 Bind this buffer to the specified TFB buffer binding point. More...
 
void BindBaseAtomicCounter (AtomicCounterBufferBindingPoint index) const
 Bind this buffer to the specified atomic counter buffer binding point. More...
 
void BindBaseShaderStorage (ShaderStorageBufferBindingPoint index) const
 Bind this buffer to the specified shader storage buffer binding point. More...
 
void BindRange (IndexedTarget target, GLuint index, GLintptr offset, GLsizeiptr size) const
 Bind a range in this buffer to the specified indexed target. More...
 
void InvalidateData (void)
 Invalidate the buffer data. More...
 
void InvalidateSubData (GLintptr offset, GLsizeiptr size)
 Invalidate a subrange of the buffer data. More...
 

Static Public Member Functions

static bool Mapped (Target target)
 Returns true if the buffer is mapped. More...
 
static void Unbind (Target target)
 Unbind the current buffer from the specified target. More...
 
static void UnbindBase (IndexedTarget target, GLuint index)
 Unbind the current buffer from the specified indexed target. More...
 
template<typename GLtype >
static void Data (Target target, GLsizei count, const GLtype *data, BufferUsage usage=BufferUsage::StaticDraw)
 Uploads (sets) the buffer data. More...
 
template<typename GLtype >
static void Data (Target target, const std::vector< GLtype > &data, BufferUsage usage=BufferUsage::StaticDraw)
 Uploads (sets) the buffer data. More...
 
template<typename GLtype , std::size_t N>
static void Data (Target target, const std::vector< Vector< GLtype, N > > &data, BufferUsage usage=BufferUsage::StaticDraw)
 Uploads (sets) the buffer data. More...
 
template<typename GLtype >
static void SubData (Target target, GLintptr offset, GLsizei count, const GLtype *data)
 Uploads (sets) a subrange of the buffer data. More...
 
template<typename GLtype >
static void SubData (Target target, GLintptr offset, const std::vector< GLtype > &data)
 Uploads (sets) a subrange of the buffer data. More...
 
static void CopySubData (BufferOps::Target readtarget, BufferOps::Target writetarget, GLintptr readoffset, GLintptr writeoffset, GLsizeiptr size)
 Copy data between buffers. More...
 
template<typename GLtype >
static void ClearData (Target target, PixelDataInternalFormat internal_format, PixelDataFormat format, const GLtype *data)
 Clear the buffer data. More...
 
template<typename GLtype >
static void ClearSubData (Target target, PixelDataInternalFormat internal_format, GLintptr offset, GLsizeiptr size, PixelDataFormat format, const GLtype *data)
 Clear a subrange of the buffer data. More...
 
template<typename GLtype >
static void Storage (Target target, GLsizeiptr size, const void *data, Bitfield< BufferStorageBit > flags)
 Creates a data store for a buffer object. More...
 
static bool ImmutableStorage (Target target)
 Returns true if the buffer storage is immutable. More...
 
static Bitfield< BufferStorageBitStorageFlags (Target target)
 Returns the buffer storage flags. More...
 
static GLsizei Size (Target target)
 Returns the buffer size. More...
 
static BufferUsage Usage (Target target)
 Returns the buffer usage. More...
 
static Bitfield< BufferMapAccessAccess (Target target)
 Returns the buffer usage. More...
 
static void MakeResident (Target target, AccessSpecifier access)
 Makes buffer currently bound to target accessible to GLSL shaders. More...
 
static void MakeNonResident (Target target)
 Makes buffer currently bound to target inaccessible to GLSL shaders. More...
 
static BufferGPUAddress GPUAddress (Target target)
 Returns the GPU address of the buffer currently bound to target. More...
 

Detailed Description

Member Function Documentation

static Bitfield<BufferMapAccess> oglplus::BufferOps::Access ( Target  target)
staticinherited

Returns the buffer usage.

See Also
Usage
Related OpenGL symbols:
glGetBufferParameter GL_BUFFER_ACCESS
Exceptions
Error

Referenced by oglplus::BoundTemplate< Base, BaseParam, BufferOps >::Access().

void oglplus::BufferOps::Bind ( Target  target) const
inherited
void oglplus::BufferOps::Bind ( IndexedTarget  target,
GLuint  index 
) const
inherited

Bind this buffer to the specified indexed target.

Exceptions
Error

References oglplus::BufferOps::BindBase().

void oglplus::BufferOps::BindBase ( IndexedTarget  target,
GLuint  index 
) const
inherited
void oglplus::BufferOps::BindBaseAtomicCounter ( AtomicCounterBufferBindingPoint  index) const
inherited

Bind this buffer to the specified atomic counter buffer binding point.

Exceptions
ErrorRequires OpenGL 4.2 or the GL_ARB_shader_atomic_counters extension.

References oglplus::AtomicCounter, and oglplus::BufferOps::BindBase().

void oglplus::BufferOps::BindBaseShaderStorage ( ShaderStorageBufferBindingPoint  index) const
inherited

Bind this buffer to the specified shader storage buffer binding point.

Exceptions
ErrorRequires OpenGL 4.3 or the GL_ARB_shader_storage_buffer_object extension.

References oglplus::BufferOps::BindBase(), and oglplus::ShaderStorage.

void oglplus::BufferOps::BindBaseTransformFeedback ( TransformFeedbackBufferBindingPoint  index) const
inherited

Bind this buffer to the specified TFB buffer binding point.

Exceptions
ErrorRequires OpenGL 4.0 or the GL_ARB_transform_feedback3 extension.

References oglplus::BufferOps::BindBase(), and oglplus::TransformFeedback.

void oglplus::BufferOps::BindBaseUniform ( UniformBufferBindingPoint  index) const
inherited

Bind this buffer to the specified uniform buffer binding point.

Exceptions
ErrorRequires OpenGL 4.0 or the GL_ARB_transform_feedback3 extension.

References oglplus::BufferOps::BindBase(), and oglplus::Uniform.

void oglplus::BufferOps::BindRange ( IndexedTarget  target,
GLuint  index,
GLintptr  offset,
GLsizeiptr  size 
) const
inherited

Bind a range in this buffer to the specified indexed target.

Exceptions
Error

References oglplus::EnumValueName(), and OGLPLUS_VERIFY.

template<typename GLtype >
static void oglplus::BufferOps::ClearData ( Target  target,
PixelDataInternalFormat  internal_format,
PixelDataFormat  format,
const GLtype *  data 
)
staticinherited

Clear the buffer data.

See Also
Data
ClearSubData
SubData
CopySubData
Exceptions
ErrorRequires OpenGL 4.3.

References oglplus::EnumValueName(), and OGLPLUS_CHECK.

Referenced by oglplus::BoundTemplate< Base, BaseParam, BufferOps >::ClearData().

template<typename GLtype >
static void oglplus::BufferOps::ClearSubData ( Target  target,
PixelDataInternalFormat  internal_format,
GLintptr  offset,
GLsizeiptr  size,
PixelDataFormat  format,
const GLtype *  data 
)
staticinherited

Clear a subrange of the buffer data.

See Also
Data
ClearData
SubData
CopySubData
Exceptions
ErrorRequires OpenGL 4.3.

References oglplus::EnumValueName(), and OGLPLUS_CHECK.

Referenced by oglplus::BoundTemplate< Base, BaseParam, BufferOps >::ClearSubData().

static void oglplus::BufferOps::CopySubData ( BufferOps::Target  readtarget,
BufferOps::Target  writetarget,
GLintptr  readoffset,
GLintptr  writeoffset,
GLsizeiptr  size 
)
staticinherited

Copy data between buffers.

See Also
Data
SubData
Exceptions
ErrorRequires OpenGL 3.1 or the GL_ARB_copy_buffer extension.
Examples:
oglplus/029_gpu_sort_tfb.cpp, oglplus/031_neon.cpp, and oglplus/040_jelly_cube.cpp.

References OGLPLUS_CHECK.

template<typename GLtype >
static void oglplus::BufferOps::Data ( Target  target,
GLsizei  count,
const GLtype *  data,
BufferUsage  usage = BufferUsage::StaticDraw 
)
staticinherited

Uploads (sets) the buffer data.

This member function uploads count units of sizeof(GLtype) from the location pointed to by data to the buffer bound to the specified target using the usage as hint.

See Also
SubData
CopySubData
Exceptions
Error
Examples:
oglplus/001_triangle.cpp, oglplus/001_triangle_glsl120.cpp, oglplus/002_rect.cpp, oglplus/002_shader_lit.cpp, oglplus/002_triangle.cpp, oglplus/003_rect.cpp, oglplus/003_triangle.cpp, oglplus/004_newton.cpp, oglplus/004_rect.cpp, oglplus/005_mandelbrot.cpp, oglplus/006_cartoon_sun.cpp, oglplus/006_newton_zoom.cpp, oglplus/008_lyapunov.cpp, oglplus/009_metaballs.cpp, oglplus/010_cmy_cube_glsl120.cpp, oglplus/010_rgb_cube.cpp, oglplus/012_checker_sphere.cpp, oglplus/013_striped_cubes.cpp, oglplus/014_multi_cube.cpp, oglplus/014_multi_cube_gs.cpp, oglplus/014_multi_cube_ub.cpp, oglplus/015_graph.cpp, oglplus/015_obj_mesh.cpp, oglplus/016_cartoon_torus.cpp, oglplus/016_metallic_torus.cpp, oglplus/016_textured_cube.cpp, oglplus/016_textured_cube_glsl120.cpp, oglplus/017_clipped_torus.cpp, oglplus/017_phong_torus.cpp, oglplus/017_single_pass_edges.cpp, oglplus/017_sky_box.cpp, oglplus/018_atomic_counters.cpp, oglplus/018_newton_landscape.cpp, oglplus/018_particle_system.cpp, oglplus/018_stained_glass_cube.cpp, oglplus/019_bpatch_tess.cpp, oglplus/019_gs_tessell.cpp, oglplus/019_helium.cpp, oglplus/019_honeycomb_cube.cpp, oglplus/019_subsurf_scatter.cpp, oglplus/019_tessellation.cpp, oglplus/020_checkered_objects.cpp, oglplus/020_cube_mapping.cpp, oglplus/020_golf_ball.cpp, oglplus/020_icosphere.cpp, oglplus/020_octree.cpp, oglplus/020_shaded_objects.cpp, oglplus/020_texture_projection.cpp, oglplus/021_morphing.cpp, oglplus/022_parallax_map.cpp, oglplus/022_volumetric_light.cpp, oglplus/022_xyz_planes.cpp, oglplus/023_lattice_torus.cpp, oglplus/023_reflected_cube.cpp, oglplus/023_waves.cpp, oglplus/024_extruded_torus.cpp, oglplus/024_particle_trails.cpp, oglplus/024_simple_picking.cpp, oglplus/025_multi_viewport.cpp, oglplus/025_recursive_texture.cpp, oglplus/025_reflected_torus.cpp, oglplus/025_rendered_texture.cpp, oglplus/026_clouds.cpp, oglplus/026_furry_torus.cpp, oglplus/026_shape_halo.cpp, oglplus/026_stencil_shadow.cpp, oglplus/027_depth_of_field.cpp, oglplus/027_reflected_shape.cpp, oglplus/027_smoke_trails.cpp, oglplus/027_tessellation.cpp, oglplus/028_glass_shape.cpp, oglplus/028_ripples.cpp, oglplus/028_volume.cpp, oglplus/029_flares.cpp, oglplus/029_shadow_mapping.cpp, oglplus/029_surface.cpp, oglplus/029_waves.cpp, oglplus/030_cube_mapping.cpp, oglplus/030_rain.cpp, oglplus/031_blob.cpp, oglplus/031_motion_blur.cpp, oglplus/031_neon.cpp, oglplus/031_sketch.cpp, oglplus/032_bar_grid.cpp, oglplus/032_object_tracking.cpp, oglplus/032_transitions.cpp, oglplus/033_metal_and_glass.cpp, oglplus/034_billiard_balls.cpp, oglplus/040_jelly_cube.cpp, oglplus/041_blob_mt.cpp, standalone/001_triangle_screenshot.cpp, and standalone/007_glm_boxes.cpp.

References oglplus::EnumValueName(), and OGLPLUS_CHECK.

Referenced by oglplus::BoundTemplate< Base, BaseParam, BufferOps >::Data().

template<typename GLtype >
static void oglplus::BufferOps::Data ( Target  target,
const std::vector< GLtype > &  data,
BufferUsage  usage = BufferUsage::StaticDraw 
)
staticinherited

Uploads (sets) the buffer data.

This member function uploads data.size() units of sizeof(GLtype) from the location pointed to by data.data() to the buffer bound to the specified target using the usage as hint.

See Also
SubData
CopySubData
Exceptions
Error

References oglplus::EnumValueName(), and OGLPLUS_CHECK.

template<typename GLtype , std::size_t N>
static void oglplus::BufferOps::Data ( Target  target,
const std::vector< Vector< GLtype, N > > &  data,
BufferUsage  usage = BufferUsage::StaticDraw 
)
staticinherited

Uploads (sets) the buffer data.

See Also
SubData
CopySubData
Exceptions
Error

References oglplus::EnumValueName(), and OGLPLUS_CHECK.

static BufferGPUAddress oglplus::BufferOps::GPUAddress ( Target  target)
staticinherited

Returns the GPU address of the buffer currently bound to target.

Requires the GL_NV_shader_buffer_load extension.

Related OpenGL symbols:
glGetBufferParameterui64vNV GL_BUFFER_GPU_ADDRESS_NV
Exceptions
Error

References OGLPLUS_CHECK.

Referenced by oglplus::BoundTemplate< Base, BaseParam, BufferOps >::GPUAddress().

static bool oglplus::BufferOps::ImmutableStorage ( Target  target)
staticinherited

Returns true if the buffer storage is immutable.

Exceptions
ErrorRequires OpenGL 4.4 or the GL_ARB_buffer_storage extension.
Related OpenGL symbols:
glGetBufferParameter GL_BUFFER_IMMUTABLE_STORAGE

Referenced by oglplus::BoundTemplate< Base, BaseParam, BufferOps >::ImmutableStorage().

void oglplus::BufferOps::InvalidateData ( void  )
inherited

Invalidate the buffer data.

See Also
Data
ClearData
Exceptions
ErrorRequires OpenGL 4.3 or the GL_ARB_invalidate_subdata extension.

References OGLPLUS_CHECK.

void oglplus::BufferOps::InvalidateSubData ( GLintptr  offset,
GLsizeiptr  size 
)
inherited

Invalidate a subrange of the buffer data.

See Also
Data
SubData
InvalidateData
Exceptions
ErrorRequires OpenGL 4.3 or the GL_ARB_invalidate_subdata extension.

References OGLPLUS_CHECK.

static void oglplus::BufferOps::MakeNonResident ( Target  target)
staticinherited

Makes buffer currently bound to target inaccessible to GLSL shaders.

Requires the GL_NV_shader_buffer_load extension.

Related OpenGL symbols:
glMakeBufferNonResidentNV
Exceptions
Error

References oglplus::EnumValueName(), and OGLPLUS_CHECK.

Referenced by oglplus::BoundTemplate< Base, BaseParam, BufferOps >::MakeNonResident().

static void oglplus::BufferOps::MakeResident ( Target  target,
AccessSpecifier  access 
)
staticinherited

Makes buffer currently bound to target accessible to GLSL shaders.

Requires the GL_NV_shader_buffer_load extension.

Related OpenGL symbols:
glMakeBufferResidentNV
Exceptions
Error

References oglplus::EnumValueName(), and OGLPLUS_CHECK.

Referenced by oglplus::BoundTemplate< Base, BaseParam, BufferOps >::MakeResident().

static bool oglplus::BufferOps::Mapped ( Target  target)
staticinherited

Returns true if the buffer is mapped.

Related OpenGL symbols:
glGetBufferParameter GL_BUFFER_MAPPED
Exceptions
Error

Referenced by oglplus::BoundTemplate< Base, BaseParam, BufferOps >::Mapped().

static GLsizei oglplus::BufferOps::Size ( Target  target)
staticinherited

Returns the buffer size.

Related OpenGL symbols:
glGetBufferParameter GL_BUFFER_SIZE
Exceptions
Error

Referenced by oglplus::BoundTemplate< Base, BaseParam, BufferOps >::Size().

template<typename GLtype >
static void oglplus::BufferOps::Storage ( Target  target,
GLsizeiptr  size,
const void *  data,
Bitfield< BufferStorageBit flags 
)
staticinherited

Creates a data store for a buffer object.

See Also
Data
SubData
CopySubData
Exceptions
ErrorRequires OpenGL 4.4 or the GL_ARB_buffer_storage extension.
Related OpenGL symbols:
glBufferStorage

References oglplus::EnumValueName(), and OGLPLUS_CHECK.

Referenced by oglplus::BoundTemplate< Base, BaseParam, BufferOps >::Storage().

static Bitfield<BufferStorageBit> oglplus::BufferOps::StorageFlags ( Target  target)
staticinherited

Returns the buffer storage flags.

Exceptions
ErrorRequires OpenGL 4.4 or the GL_ARB_buffer_storage extension.
Related OpenGL symbols:
glGetBufferParameter GL_BUFFER_STORAGE_FLAGS

Referenced by oglplus::BoundTemplate< Base, BaseParam, BufferOps >::StorageFlags().

template<typename GLtype >
static void oglplus::BufferOps::SubData ( Target  target,
GLintptr  offset,
GLsizei  count,
const GLtype *  data 
)
staticinherited

Uploads (sets) a subrange of the buffer data.

See Also
Data
CopySubData
Exceptions
Error
Examples:
oglplus/018_atomic_counters.cpp.

References oglplus::EnumValueName(), and OGLPLUS_CHECK.

Referenced by oglplus::BoundTemplate< Base, BaseParam, BufferOps >::SubData().

template<typename GLtype >
static void oglplus::BufferOps::SubData ( Target  target,
GLintptr  offset,
const std::vector< GLtype > &  data 
)
staticinherited

Uploads (sets) a subrange of the buffer data.

See Also
Data
CopySubData
Exceptions
Error

References oglplus::EnumValueName(), and OGLPLUS_CHECK.

static void oglplus::BufferOps::Unbind ( Target  target)
staticinherited

Unbind the current buffer from the specified target.

This function binds the name 0 to the specified target.

Exceptions
Error

References oglplus::EnumValueName(), and OGLPLUS_VERIFY.

static void oglplus::BufferOps::UnbindBase ( IndexedTarget  target,
GLuint  index 
)
staticinherited

Unbind the current buffer from the specified indexed target.

Exceptions
Error

References OGLPLUS_VERIFY.

static BufferUsage oglplus::BufferOps::Usage ( Target  target)
staticinherited

Returns the buffer usage.

See Also
Access
Related OpenGL symbols:
glGetBufferParameter GL_BUFFER_USAGE
Exceptions
Error

Referenced by oglplus::BoundTemplate< Base, BaseParam, BufferOps >::Usage().


The documentation for this class was generated from the following file:
  • /home/chochlik/devel/oglplus/include/oglplus/buffer.hpp

Copyright © 2010-2014 Matúš Chochlík, University of Žilina, Žilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Wed Apr 30 2014 by Doxygen (version 1.8.4).