Jopnal Engine  alpha 0.4
Simple Component Based 2D/3D Game Engine
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
jop::Buffer Class Referenceabstract

#include <Buffer.hpp>

Inheritance diagram for jop::Buffer:
jop::VertexBuffer

Public Types

enum  Type { Type::ArrayBuffer, Type::ElementArrayBuffer, Type::UniformBuffer }
 Enum class consisting of buffer types. More...
 
enum  Usage { StaticDraw, DynamicDraw, StreamDraw }
 Enum of usage types. More...
 

Public Member Functions

 Buffer (const Type type, const Usage usage)
 Constructor. More...
 
 Buffer (const Buffer &other)
 Copy constructor. More...
 
Bufferoperator= (const Buffer &other)
 Copy assignment operator. More...
 
 Buffer (Buffer &&other)
 Move constructor. More...
 
Bufferoperator= (Buffer &&other)
 Move assignment operator. More...
 
virtual ~Buffer ()=0
 Virtual destructor. More...
 
void bind () const
 Bind this buffer. More...
 
void clear ()
 Clear this buffer. More...
 
void destroy ()
 Destroy this buffer. More...
 
std::size_t getAllocatedSize () const
 Get the allocated size in bytes. More...
 

Static Public Member Functions

static void unbind (const Type type)
 Unbind a buffer. More...
 

Protected Attributes

std::size_t m_bytesAllocated
 Size of the allocated buffer. More...
 
unsigned int m_buffer
 Buffer's OpenGL handle. More...
 
const int m_bufferType
 Type of the buffer. More...
 
const int m_usage
 The usage type. More...
 

Detailed Description

Definition at line 34 of file Buffer.hpp.

Member Enumeration Documentation

enum jop::Buffer::Type
strong

Enum class consisting of buffer types.

Enumerator
ArrayBuffer 

Array buffer (vertex data)

ElementArrayBuffer 

Element buffer (index data)

UniformBuffer 

Uniform buffer.

Definition at line 40 of file Buffer.hpp.

Enum of usage types.

Enumerator
StaticDraw 

Static buffer, use when the data rarely changes.

DynamicDraw 

Dynamic buffer, use when the data changes often.

StreamDraw 

Stream buffer, use when the data changes all the time.

Definition at line 49 of file Buffer.hpp.

Constructor & Destructor Documentation

jop::Buffer::Buffer ( const Type  type,
const Usage  usage 
)

Constructor.

Parameters
typeBuffer type
usageUsage type
jop::Buffer::Buffer ( const Buffer other)

Copy constructor.

jop::Buffer::Buffer ( Buffer &&  other)

Move constructor.

virtual jop::Buffer::~Buffer ( )
pure virtual

Virtual destructor.

Member Function Documentation

void jop::Buffer::bind ( ) const

Bind this buffer.

void jop::Buffer::clear ( )

Clear this buffer.

The buffer itself won't be destroyed, only the data.

void jop::Buffer::destroy ( )

Destroy this buffer.

std::size_t jop::Buffer::getAllocatedSize ( ) const

Get the allocated size in bytes.

Returns
The allocated size
Buffer& jop::Buffer::operator= ( const Buffer other)

Copy assignment operator.

Buffer& jop::Buffer::operator= ( Buffer &&  other)

Move assignment operator.

static void jop::Buffer::unbind ( const Type  type)
static

Unbind a buffer.

Parameters
typeThe buffer type to unbind

Member Data Documentation

unsigned int jop::Buffer::m_buffer
mutableprotected

Buffer's OpenGL handle.

Definition at line 115 of file Buffer.hpp.

const int jop::Buffer::m_bufferType
protected

Type of the buffer.

Definition at line 116 of file Buffer.hpp.

std::size_t jop::Buffer::m_bytesAllocated
protected

Size of the allocated buffer.

Definition at line 114 of file Buffer.hpp.

const int jop::Buffer::m_usage
protected

The usage type.

Definition at line 117 of file Buffer.hpp.


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