SimpleGL  1.1.0
A framework for platform independent rendering
Public Member Functions | List of all members
sgl::Buffer Class Reference

This class wraps an OpenGL buffer object. More...

#include <vertex_buffer_object.hpp>

Public Member Functions

 Buffer (void)
 Generates a new buffer object. More...
 
 ~Buffer (void)
 Deletes the buffer object. More...
 
GLuint getHandle ()
 Returns the handle of the buffer object. More...
 
void bind (BufferTarget target)
 Binds the buffer object with the specified target. More...
 
void uploadData (BufferTarget target, long size, float *data, BufferUsage usage)
 Uploads the specified data to the buffer object. More...
 
void uploadData (BufferTarget target, long size, std::vector< float > data, BufferUsage usage)
 Uploads the specified data to the buffer object. More...
 
void uploadData (BufferTarget target, long size, std::vector< glm::vec2 > data, BufferUsage usage)
 Uploads the specified data to the buffer object. More...
 
void uploadData (BufferTarget target, long size, std::vector< glm::vec3 > data, BufferUsage usage)
 Uploads the specified data to the buffer object. More...
 
void uploadData (BufferTarget target, long size, std::vector< glm::vec4 > data, BufferUsage usage)
 Uploads the specified data to the buffer object. More...
 
void uploadData (BufferTarget target, long size, BufferUsage usage)
 Uploads NULL data to the buffer object to allocate memory. More...
 
void uploadSubData (BufferTarget target, long offset, long size, float *data)
 Uploads the specified data to the buffer object starting at the offset. More...
 
void uploadSubData (BufferTarget target, long offset, long size, std::vector< float > data)
 Uploads the specified data to the buffer object starting at the offset. More...
 
void uploadSubData (BufferTarget target, long offset, long size, std::vector< glm::vec2 > data)
 Uploads the specified data to the buffer object starting at the offset. More...
 
void uploadSubData (BufferTarget target, long offset, long size, std::vector< glm::vec3 > data)
 Uploads the specified data to the buffer object starting at the offset. More...
 
void uploadSubData (BufferTarget target, long offset, long size, std::vector< glm::vec4 > data)
 Uploads the specified data to the buffer object starting at the offset. More...
 
void * map (BufferTarget target, MapAccess access)
 Maps the buffer object. More...
 
void * mapRange (BufferTarget target, long offset, long length, MapRangeAccess access)
 Maps the buffer object starting at the offset. More...
 
void unmap (BufferTarget target)
 Unmaps the buffer object. More...
 

Detailed Description

This class wraps an OpenGL buffer object.

Definition at line 106 of file vertex_buffer_object.hpp.

Constructor & Destructor Documentation

sgl::Buffer::Buffer ( void  )

Generates a new buffer object.

Definition at line 17 of file vertex_buffer_object.cpp.

sgl::Buffer::~Buffer ( void  )

Deletes the buffer object.

Definition at line 21 of file vertex_buffer_object.cpp.

Member Function Documentation

void sgl::Buffer::bind ( BufferTarget  target)

Binds the buffer object with the specified target.

Parameters
targetTarget to bind.

Definition at line 34 of file vertex_buffer_object.cpp.

GLuint sgl::Buffer::getHandle ( )

Returns the handle of the buffer object.

Returns
The handle of the buffer object.

Definition at line 30 of file vertex_buffer_object.cpp.

void * sgl::Buffer::map ( BufferTarget  target,
MapAccess  access 
)

Maps the buffer object.

Parameters
targetTarget to map.
accessAccess policy of the mapping.
Returns
A pointer to the data storage.

Definition at line 89 of file vertex_buffer_object.cpp.

void * sgl::Buffer::mapRange ( BufferTarget  target,
long  offset,
long  length,
MapRangeAccess  access 
)

Maps the buffer object starting at the offset.

Parameters
targetTarget to map.
offsetOffset where the mapping should start.
lengthLength of the mapping in bytes.
accessAccess policy of the mapping.
Returns
A pointer to the data storage.

Definition at line 93 of file vertex_buffer_object.cpp.

void sgl::Buffer::unmap ( BufferTarget  target)

Unmaps the buffer object.

Parameters
targetTarget to unmap.

Definition at line 97 of file vertex_buffer_object.cpp.

void sgl::Buffer::uploadData ( BufferTarget  target,
long  size,
float *  data,
BufferUsage  usage 
)

Uploads the specified data to the buffer object.

Parameters
targetTarget to upload.
sizeSize in bytes of the data to upload.
dataThe data to upload as a float array.
usageUsage of the data.

Definition at line 45 of file vertex_buffer_object.cpp.

void sgl::Buffer::uploadData ( BufferTarget  target,
long  size,
std::vector< float >  data,
BufferUsage  usage 
)

Uploads the specified data to the buffer object.

Parameters
targetTarget to upload.
sizeSize in bytes of the data to upload.
dataThe data to upload as a float vector.
usageUsage of the data.

Definition at line 49 of file vertex_buffer_object.cpp.

void sgl::Buffer::uploadData ( BufferTarget  target,
long  size,
std::vector< glm::vec2 >  data,
BufferUsage  usage 
)

Uploads the specified data to the buffer object.

Parameters
targetTarget to upload.
sizeSize in bytes of the data to upload.
dataThe data to upload as a float vector.
usageUsage of the data.

Definition at line 53 of file vertex_buffer_object.cpp.

void sgl::Buffer::uploadData ( BufferTarget  target,
long  size,
std::vector< glm::vec3 >  data,
BufferUsage  usage 
)

Uploads the specified data to the buffer object.

Parameters
targetTarget to upload.
sizeSize in bytes of the data to upload.
dataThe data to upload as a float vector.
usageUsage of the data.

Definition at line 57 of file vertex_buffer_object.cpp.

void sgl::Buffer::uploadData ( BufferTarget  target,
long  size,
std::vector< glm::vec4 >  data,
BufferUsage  usage 
)

Uploads the specified data to the buffer object.

Parameters
targetTarget to upload.
sizeSize in bytes of the data to upload.
dataThe data to upload as a float vector.
usageUsage of the data.

Definition at line 61 of file vertex_buffer_object.cpp.

void sgl::Buffer::uploadData ( BufferTarget  target,
long  size,
BufferUsage  usage 
)

Uploads NULL data to the buffer object to allocate memory.

Parameters
targetTarget to upload.
sizeSize in bytes of the data store.
usageUsage of the data.

Definition at line 65 of file vertex_buffer_object.cpp.

void sgl::Buffer::uploadSubData ( BufferTarget  target,
long  offset,
long  size,
float *  data 
)

Uploads the specified data to the buffer object starting at the offset.

Parameters
targetTarget to upload.
offsetOffset where the data should get uploaded in bytes.
sizeSize in bytes of the data to upload.
dataThe data to upload as a float array.

Definition at line 69 of file vertex_buffer_object.cpp.

void sgl::Buffer::uploadSubData ( BufferTarget  target,
long  offset,
long  size,
std::vector< float >  data 
)

Uploads the specified data to the buffer object starting at the offset.

Parameters
targetTarget to upload.
offsetOffset where the data should get uploaded in bytes.
sizeSize in bytes of the data to upload.
dataThe data to upload as a float array.

Definition at line 73 of file vertex_buffer_object.cpp.

void sgl::Buffer::uploadSubData ( BufferTarget  target,
long  offset,
long  size,
std::vector< glm::vec2 >  data 
)

Uploads the specified data to the buffer object starting at the offset.

Parameters
targetTarget to upload.
offsetOffset where the data should get uploaded in bytes.
sizeSize in bytes of the data to upload.
dataThe data to upload as a float array.

Definition at line 77 of file vertex_buffer_object.cpp.

void sgl::Buffer::uploadSubData ( BufferTarget  target,
long  offset,
long  size,
std::vector< glm::vec3 >  data 
)

Uploads the specified data to the buffer object starting at the offset.

Parameters
targetTarget to upload.
offsetOffset where the data should get uploaded in bytes.
sizeSize in bytes of the data to upload.
dataThe data to upload as a float array.

Definition at line 81 of file vertex_buffer_object.cpp.

void sgl::Buffer::uploadSubData ( BufferTarget  target,
long  offset,
long  size,
std::vector< glm::vec4 >  data 
)

Uploads the specified data to the buffer object starting at the offset.

Parameters
targetTarget to upload.
offsetOffset where the data should get uploaded in bytes.
sizeSize in bytes of the data to upload.
dataThe data to upload as a float array.

Definition at line 85 of file vertex_buffer_object.cpp.


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