cgv
cgv::render::vertex_buffer Class Reference

#include <vertex_buffer.h>

Inheritance diagram for cgv::render::vertex_buffer:
cgv::render::vertex_buffer_base cgv::render::render_component

Public Member Functions

 vertex_buffer (VertexBufferType _type=VBT_VERTICES, VertexBufferUsage _usage=VBU_STATIC_DRAW)
 construct from description of component format, where the default format specifies a color buffer with alpha channel
 
 ~vertex_buffer ()
 calls the destruct method if necessary
 
void bind (context &ctx, VertexBufferType _type=VBT_UNDEF) const
 bind buffer potentially overwriting buffer type
 
bool create (const context &ctx, size_t size_in_bytes)
 create empty vertex buffer of size size given in bytes
 
template<typename T >
bool create (const context &ctx, const T &array)
 create vertex buffer and copy data from CPU array array into buffer memory
 
template<typename T >
bool create (const context &ctx, const T *array_ptr, size_t nr_elements)
 create vertex buffer and copy data from CPU array array_ptr into buffer memory
 
bool is_created () const
 check whether the vertex buffer has been created
 
size_t get_size_in_bytes () const
 return size in bytes
 
template<typename T >
bool replace (const context &ctx, size_t buffer_offset_in_bytes, const T *array_ptr, size_t nr_elements)
 replace part (starting at byte offset buffer_offset_in_bytes) or whole vertex buffer content from nr_elements of CPU array array_ptr
 
bool copy (const context &ctx, size_t src_offset_in_bytes, size_t size_in_bytes, vertex_buffer &dst, size_t dst_offset_in_bytes) const
 copy size_in_bytes number bytes from this vertex buffer starting at byte offset start_offset_in_bytes to vertex buffer dst starting at offest dst_offset_in_bytes
 
template<typename T >
bool copy (const context &ctx, size_t src_offset_in_bytes, T *array_ptr, size_t nr_elements)
 copy nr_elements array elements from vertex buffer starting at byte offset start_offset_in_bytes to CPU array array_ptr
 
void destruct (const context &ctx)
 destruct the render buffer
 
void put_id_void (void *ptr) const
 
template<typename T >
void put_id (T &id) const
 cast the refence to rendering api specific representation of component id to the specified type
 

Public Attributes

VertexBufferType type
 buffer type defaults to VBT_VERTICES
 
VertexBufferUsage usage
 usage defaults to VBU_STATIC_DRAW
 
const contextctx_ptr
 keep pointer to my context
 
std::string last_error
 a string that contains the last error
 

Detailed Description

a vertex buffer is an unstructured memory block on the GPU.

Member Function Documentation

◆ put_id_void()

void cgv::render::render_component::put_id_void ( void *  ptr) const
inherited

copy the rendering api specific id the component to the memory location of the given pointer. For opengl this the passed pointer should be of type GLint or GLuint.


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