Brenta Engine 1.2
Loading...
Searching...
No Matches
brenta::types::buffer Class Reference

Buffer wrapper around OpenGL buffer objects. More...

#include <buffer.hpp>

Inheritance diagram for brenta::types::buffer:
brenta::types::framebuffer

Public Member Functions

 buffer ()
 Default constructor, does nothing.
 
 buffer (GLenum input_target)
 
constexpr buffer (const buffer &)=delete
 
constexpr bufferoperator= (const buffer &)=delete
 
constexpr buffer (buffer &&other) noexcept
 
constexpr bufferoperator= (buffer &&other) noexcept
 
void init (GLenum input_target)
 
void destroy ()
 
void bind ()
 
void unbind ()
 
int get_id ()
 
GLenum get_target ()
 
void set_id (unsigned int id)
 
void set_target (GLenum target)
 
void copy_data (GLsizeiptr size, const void *data, GLenum usage)
 Copy data to the buffer object.
 
void copy_vertices (GLsizeiptr size, const void *data, GLenum usage)
 Copy data to the buffer object.
 
void copy_indices (GLsizeiptr size, const void *data, GLenum usage)
 Copy data to the buffer object.
 

Data Fields

unsigned int id
 Buffer object id, generated by OpenGL.
 
GLenum target
 Buffer object target (like GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER...)
 

Detailed Description

Buffer wrapper around OpenGL buffer objects.

This class is a wrapper around OpenGL buffer objects. It provides a simple interface to create, bind, unbind and delete buffer objects.

Definition at line 22 of file buffer.hpp.

Constructor & Destructor Documentation

◆ buffer() [1/3]

brenta::types::buffer::buffer ( )
inline

Default constructor, does nothing.

Definition at line 38 of file buffer.hpp.

◆ buffer() [2/3]

buffer::buffer ( GLenum  input_target)

Definition at line 12 of file buffer.cpp.

◆ buffer() [3/3]

constexpr brenta::types::buffer::buffer ( buffer &&  other)
inlineconstexprnoexcept

Definition at line 47 of file buffer.hpp.

◆ ~buffer()

buffer::~buffer ( )

Definition at line 17 of file buffer.cpp.

Member Function Documentation

◆ bind()

void buffer::bind ( )

Definition at line 63 of file buffer.cpp.

◆ copy_data()

void buffer::copy_data ( GLsizeiptr  size,
const void *  data,
GLenum  usage 
)

Copy data to the buffer object.

Parameters
sizeSize of the data in bytes
dataPointer to the data
usageOpenGL usage hint (like GL_STATIC_DRAW)

Definition at line 22 of file buffer.cpp.

◆ copy_indices()

void buffer::copy_indices ( GLsizeiptr  size,
const void *  data,
GLenum  usage 
)

Copy data to the buffer object.

Parameters
sizeSize of the data in bytes
dataPointer to the data
usageOpenGL usage hint (like GL_STATIC_DRAW)

Same as copy_vertices() but for target GL_ELEMENT_ARRAY_BUFFER.

Definition at line 27 of file buffer.cpp.

◆ copy_vertices()

void buffer::copy_vertices ( GLsizeiptr  size,
const void *  data,
GLenum  usage 
)

Copy data to the buffer object.

Parameters
sizeSize of the data in bytes
dataPointer to the data
usageOpenGL usage hint (like GL_STATIC_DRAW)

Same as copy_date() but for target GL_ARRAY_BUFFER. The naming is more specific to the use case.

Definition at line 36 of file buffer.cpp.

◆ destroy()

void buffer::destroy ( )

Definition at line 53 of file buffer.cpp.

◆ get_id()

int buffer::get_id ( )

Definition at line 78 of file buffer.cpp.

◆ get_target()

GLenum buffer::get_target ( )

Definition at line 83 of file buffer.cpp.

◆ init()

void buffer::init ( GLenum  input_target)

Definition at line 45 of file buffer.cpp.

◆ operator=()

constexpr buffer & brenta::types::buffer::operator= ( buffer &&  other)
inlineconstexprnoexcept

Definition at line 53 of file buffer.hpp.

◆ set_id()

void buffer::set_id ( unsigned int  id)

Definition at line 88 of file buffer.cpp.

◆ set_target()

void buffer::set_target ( GLenum  target)

Definition at line 93 of file buffer.cpp.

◆ unbind()

void buffer::unbind ( )

Definition at line 73 of file buffer.cpp.

Field Documentation

◆ id

unsigned int brenta::types::buffer::id

Buffer object id, generated by OpenGL.

Definition at line 28 of file buffer.hpp.

◆ target

GLenum brenta::types::buffer::target

Buffer object target (like GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER...)

Definition at line 33 of file buffer.hpp.


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