Maria GDK 5.0.0.1005
Documentation of native code in develop branch
Loading...
Searching...
No Matches
STK::BufferManager Class Reference

#include <StkBufferManager.h>

Public Member Functions

void createIndexPool (size_t initial_bytes, size_t min_block_bytes, GLenum usage=GL_DYNAMIC_DRAW)
 
 BufferManager (const BufferManager &)=delete
 
BufferManageroperator= (const BufferManager &)=delete
 
void createDefaultPools (size_t idx_initial_bytes, size_t idx_min_block_bytes, size_t vtx_initial_bytes, size_t vtx_min_block_bytes, GLenum usage=GL_DYNAMIC_DRAW)
 
void createVertexPool (int vertex_type_bits, size_t initial_bytes, size_t min_block_bytes, GLenum usage=GL_DYNAMIC_DRAW)
 
std::shared_ptr< STK::VertexPoolgetVertexPool (int vertex_type_bits) const
 
std::shared_ptr< STK::IndexPoolgetIndexPool () const
 
ItemAllocation allocate (int vertex_type_bits, size_t vertexCount, size_t indexCount=0)
 
void uploadPositions (const ItemAllocation &a, const float *pos2f)
 Upload vertex data for a given allocation.
 
void uploadNormals (const ItemAllocation &a, const float *pos2f)
 Upload normal data for a given allocation.
 
void uploadTexCoords (const ItemAllocation &a, const float *pos2f)
 Upload texture coordinate data for a given allocation.
 
void uploadIndices (const ItemAllocation &a, const uint32_t *indices)
 Upload index data for a given allocation.
 
void drawArrays (const ItemAllocation &a, GLenum mode)
 
void drawElements (const ItemAllocation &a, GLenum mode)
 
void free (const ItemAllocation &a)
 

Detailed Description

Manager for shared VBOs, EBOs and VAOS. This buffer manager should be used for efficient allocation of vertex data It is currently geared towards 2D data for use in STK::GraphicsRender2D, but can be extended later.

Member Function Documentation

◆ allocate()

ItemAllocation STK::BufferManager::allocate ( int  vertex_type_bits,
size_t  vertexCount,
size_t  indexCount = 0 
)

Allocate vertices and indexes for the given vertex type configuration. Requires that the corresponding vertex pool has been set up.

◆ createDefaultPools()

void STK::BufferManager::createDefaultPools ( size_t  idx_initial_bytes,
size_t  idx_min_block_bytes,
size_t  vtx_initial_bytes,
size_t  vtx_min_block_bytes,
GLenum  usage = GL_DYNAMIC_DRAW 
)

Create default vertex and index pools. This will set up the following pools:

  • Index pool
  • Position + Index
  • Position + Normals
  • Position + Texture Coordinates + Index
  • Position + Normals + Texture Coordinates.

◆ createIndexPool()

void STK::BufferManager::createIndexPool ( size_t  initial_bytes,
size_t  min_block_bytes,
GLenum  usage = GL_DYNAMIC_DRAW 
)

Create a buffer pool for index data (EBOs). This must be done before you can use any vertex pools with the Index VertexType set.

◆ createVertexPool()

void STK::BufferManager::createVertexPool ( int  vertex_type_bits,
size_t  initial_bytes,
size_t  min_block_bytes,
GLenum  usage = GL_DYNAMIC_DRAW 
)

Create a vertex pool. This creates a buffer pool for vertex data (VBOs). It also creates a corresponding VAO with the VBOs and possibly an EBO tied to the common IndexPool. The vertex type bits determine which VBOs to create and if it should use the Index EBO.


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