Skip to content

File Buffers.h

FileList > render > Buffers.h

Go to the source code of this file

RAII base class for OpenGL buffer objects. More...

  • #include <GL/glew.h>

Classes

Type Name
class Buffers
RAII base class for OpenGL buffer objects (GL_ARRAY_BUFFER family).

Detailed Description

Buffers owns a single OpenGL buffer object created via glGenBuffers and provides canonical copy, move, and deep-copy semantics. Derived classes (VertexBuffer, IndexBuffer, UniformBuffer, StorageBuffer) specialise the binding target and extend with type-specific upload/download helpers.

GPU Resource Ownership: * Buffers owns buf_ID; released via glDeleteBuffers in destructor. * Move transfers ownership; source buf_ID is zeroed. * Copy creates a new GPU buffer with identical content (deep copy). * Deep copy uses glCopyBufferSubData; no CPU round-trip is required.

Architecture: * This is a protected base; instantiate derived types only. * buf_size tracks the allocated byte count so deep copy knows how much to copy. * Derived constructors must update buf_size whenever glBufferData is called.


The documentation for this class was generated from the following file src/render/Buffers.h