PlottingOpenGL::GLSSBOBuffer
PlottingOpenGL::GLSSBOBuffer
RAII wrapper for a GL_SHADER_STORAGE_BUFFER. More…
#include <GLSSBOBuffer.hpp>
Public Functions
| Name | |
|---|---|
| GLSSBOBuffer() =default | |
| ~GLSSBOBuffer() | |
| GLSSBOBuffer(GLSSBOBuffer const & ) =delete | |
| GLSSBOBuffer & | operator=(GLSSBOBuffer const & ) =delete |
| GLSSBOBuffer(GLSSBOBuffer && other) | |
| GLSSBOBuffer & | operator=(GLSSBOBuffer && other) |
| bool | create() Create the underlying GL buffer object. Returns true on success. |
| void | destroy() Destroy the GL buffer object (safe to call even if not created). |
| bool | isCreated() const |
| std::uint32_t | bufferId() const |
| void | allocate(void const * data, int size_bytes) Allocate and optionally fill the buffer. |
| void | write(int offset_bytes, void const * data, int size_bytes) Write into an existing allocation without reallocating. |
| void | bindBase(std::uint32_t binding) const Bind this buffer to a numbered SSBO binding point. |
| int | size() const |
| void * | mapReadOnly() const Map the buffer for CPU read-back (GL_READ_ONLY). |
| void | unmap() const Unmap a previously mapped buffer. |
Detailed Description
class PlottingOpenGL::GLSSBOBuffer;RAII wrapper for a GL_SHADER_STORAGE_BUFFER.
Manages a single SSBO with create / upload / partial-write / bind-base operations. Destruction releases the GL resource.
All methods require a current OpenGL context.
Public Functions Documentation
function GLSSBOBuffer
GLSSBOBuffer() =defaultfunction ~GLSSBOBuffer
~GLSSBOBuffer()function GLSSBOBuffer
GLSSBOBuffer(
GLSSBOBuffer const &
) =deletefunction operator=
GLSSBOBuffer & operator=(
GLSSBOBuffer const &
) =deletefunction GLSSBOBuffer
GLSSBOBuffer(
GLSSBOBuffer && other
)function operator=
GLSSBOBuffer & operator=(
GLSSBOBuffer && other
)function create
bool create()Create the underlying GL buffer object. Returns true on success.
function destroy
void destroy()Destroy the GL buffer object (safe to call even if not created).
function isCreated
inline bool isCreated() constReturn: true if the buffer has been created and is valid.
function bufferId
inline std::uint32_t bufferId() constReturn: The raw GL buffer name (0 if not created).
function allocate
void allocate(
void const * data,
int size_bytes
)Allocate and optionally fill the buffer.
Parameters:
- data Pointer to source data, or nullptr for uninitialized allocation.
- size_bytes Total size in bytes to allocate.
Uses GL_DYNAMIC_DRAW since these buffers are updated periodically.
function write
void write(
int offset_bytes,
void const * data,
int size_bytes
)Write into an existing allocation without reallocating.
Parameters:
- offset_bytes Byte offset from the start of the buffer.
- data Pointer to source data.
- size_bytes Number of bytes to write.
function bindBase
void bindBase(
std::uint32_t binding
) constBind this buffer to a numbered SSBO binding point.
Equivalent to glBindBufferBase(GL_SHADER_STORAGE_BUFFER, binding, m_buffer_id).
function size
inline int size() constReturn: Current allocated size in bytes (as reported by GL).
function mapReadOnly
void * mapReadOnly() constMap the buffer for CPU read-back (GL_READ_ONLY).
Return: Pointer to mapped memory, or nullptr on failure. Caller must call unmap() when done.
function unmap
void unmap() constUnmap a previously mapped buffer.
Updated on 2026-11-13 at 20:25:41 +0000