CSCI441 OpenGL Library 5.9.0
CS@Mines CSCI441 Computer Graphics Course Library
Loading...
Searching...
No Matches
Public Member Functions | List of all members
CSCI441::UniformBufferObject Class Referencefinal

Storage of UBO related data. More...

#include <UniformBufferObject.hpp>

Public Member Functions

 UniformBufferObject ()=delete
 
 UniformBufferObject (const char *UNIFORM_BLOCK_NAME, std::initializer_list< const char * > uniformNamesList)
 Initializes the UniformBufferObject object.
 
 ~UniformBufferObject ()
 Deletes the UBO from the GPU and frees all memory on the CPU.
 
 UniformBufferObject (const UniformBufferObject &)=delete
 do not allow UBOs to be copied
 
UniformBufferObjectoperator= (const UniformBufferObject &)=delete
 do not allow UBOs to be copied
 
void setupWithShaderProgram (ShaderProgram *shaderProgram, GLuint bindingPoint)
 creates the UBO and allocates memory on both the CPU & GPU. binds the UBO and the uniform block for the provided ShaderProgram to the same binding point.
 
void copyToOffset (unsigned int offset, void *addr, size_t len)
 copies the value pointed to by addr to the corresponding location within the UBO as denoted by the offset
 
void copyToBuffer (const char *UNIFORM_NAME, void *addr, size_t len)
 copies the value pointed to by addr to the corresponding location within the UBO as denoted by the uniform name
 
void bindBuffer () const
 binds UBO object to UBO buffer
 
void bufferSubData () const
 transfers UBO data to UBO buffer
 

Detailed Description

Storage of UBO related data.

Constructor & Destructor Documentation

◆ UniformBufferObject() [1/2]

CSCI441::UniformBufferObject::UniformBufferObject ( )
delete
Note
must use `UniformBufferObject(const char*, std::initializer_list<const char*>

◆ UniformBufferObject() [2/2]

CSCI441::UniformBufferObject::UniformBufferObject ( const char *  UNIFORM_BLOCK_NAME,
std::initializer_list< const char * >  uniformNamesList 
)
inline

Initializes the UniformBufferObject object.

Parameters
UNIFORM_BLOCK_NAMEname of the uniform block
uniformNamesListlist of names that makeup the uniform block components

Member Function Documentation

◆ copyToBuffer()

void CSCI441::UniformBufferObject::copyToBuffer ( const char *  UNIFORM_NAME,
void *  addr,
size_t  len 
)
inline

copies the value pointed to by addr to the corresponding location within the UBO as denoted by the uniform name

Parameters
UNIFORM_NAMEname of the uniform within the block to copy value to
addrstarting address of source to copy from
lenlength of buffer to copy

◆ copyToOffset()

void CSCI441::UniformBufferObject::copyToOffset ( unsigned int  offset,
void *  addr,
size_t  len 
)
inline

copies the value pointed to by addr to the corresponding location within the UBO as denoted by the offset

Parameters
offsetUBO offset to copy value to
addrstarting address of source to copy from
lenlength of buffer to copy

◆ setupWithShaderProgram()

void CSCI441::UniformBufferObject::setupWithShaderProgram ( ShaderProgram shaderProgram,
GLuint  bindingPoint 
)
inline

creates the UBO and allocates memory on both the CPU & GPU. binds the UBO and the uniform block for the provided ShaderProgram to the same binding point.

Parameters
shaderProgramShaderProgram object that utilizes the uniformBlock
bindingPointBinding point to bind the UBO and ShaderProgram Uniform Block to

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