|
Geogram Version 1.10.2
A programming library of geometric algorithms
|
Wrapper class around the different type of buffers used by the GPU. More...
#include <geogram_gfx/GLUP/GLUP_buffer_object.h>
Public Types | |
| enum | Type { UNINITIALIZED , TEXTURE_2D , TBO , SSBO } |
Public Member Functions | |
| BufferObject () | |
| BufferObject constructor. | |
| ~BufferObject () | |
| BufferObject destructor. | |
| Type | type () const |
| Gets the type of a BufferObject. | |
| bool | initialized () const |
| Tests whether a BufferObject is initialized. | |
| void | reset () |
| Resets a BufferObject. | |
| template<class T> | |
| void | create_or_update (index_t nb, const T *data, GLuint unit=0) |
| Creates an uninitialized BufferObject or updates an initialized one with new data. | |
| template<class T> | |
| void | create_or_update (const std::vector< T > &v, index_t unit=0) |
| Creates an uninitialized BufferObject or updates an initialized one with new data. | |
| template<class T> | |
| void | create_or_update (const GEO::vector< T > &v, index_t unit=0) |
| Creates an uninitialized BufferObject or updates an initialized one with new data. | |
| void | bind (GLuint unit=0) |
| Binds this buffer to a unit. | |
Static Public Member Functions | |
| static void | register_GLSL_sources () |
| Registers GLSL sources for using portable wrappers around buffers. \TODOC. | |
| static void | initialize_class () |
| Initializes static class variables. | |
| static Type | default_type () |
| Gets the default type for BufferObjects. | |
| static void | active_unit (GLuint unit) |
| Active_Units a unit. | |
| static void | set_program_buffer_unit_by_name (GLuint program, const char *name, GLuint unit) |
| Sets a program uniform buffer unit. | |
Protected Member Functions | |
| void | reset_TEXTURE_2D () |
| GEO_TBO_FUNC void | reset_TBO () |
| GEO_SSBO_FUNC void | reset_SSBO () |
| void | bind_TEXTURE_2D (GLuint unit) |
| GEO_TBO_FUNC void | bind_TBO (GLuint unit) |
| GEO_SSBO_FUNC void | bind_SSBO (GLuint unit) |
| template<class T> | |
| void | create_or_update_TEXTURE_2D (index_t nb, const T *data) |
| template<class T> | |
| GEO_TBO_FUNC void | create_or_update_TBO (index_t nb, const T *data) |
| template<class T> | |
| GEO_SSBO_FUNC void | create_or_update_SSBO (index_t nb, const T *data) |
Static Protected Member Functions | |
| static void | active_unit_TEXTURE_2D (GLuint unit) |
| static GEO_TBO_FUNC void | active_unit_TBO (GLuint unit) |
| static GEO_SSBO_FUNC void | active_unit_SSBO (GLuint unit) |
| static GLuint | internal_format (uint32_t) |
| static GLuint | internal_format (int32_t) |
| static GLuint | internal_format (vec2i) |
| static GLuint | internal_format (vec3i) |
| static GLuint | internal_format (vec4i) |
| static GLuint | internal_format (float) |
| static GLuint | internal_format (vec2f) |
| static GLuint | internal_format (vec3f) |
| static GLuint | internal_format (vec4f) |
| static GLuint | format (uint32_t) |
| static GLuint | format (int32_t) |
| static GLuint | format (vec2i) |
| static GLuint | format (vec3i) |
| static GLuint | format (vec4i) |
| static GLuint | format (float) |
| static GLuint | format (vec2f) |
| static GLuint | format (vec3f) |
| static GLuint | format (vec4f) |
| static GLuint | type (uint32_t) |
| static GLuint | type (int32_t) |
| static GLuint | type (vec2i) |
| static GLuint | type (vec3i) |
| static GLuint | type (vec4i) |
| static GLuint | type (float) |
| static GLuint | type (vec2f) |
| static GLuint | type (vec3f) |
| static GLuint | type (vec4f) |
Wrapper class around the different type of buffers used by the GPU.
Wraps either a 2D texture, a TBO (Texture Buffer Object) or an SSBO, depending on what is supported and on user-specified gfx:buffers command line argument.
Definition at line 102 of file GLUP_buffer_object.h.
| enum GLUP::BufferObject::Type |
Definition at line 104 of file GLUP_buffer_object.h.
|
inline |
BufferObject constructor.
Constructs an uninitialized BufferObject
Definition at line 110 of file GLUP_buffer_object.h.
|
inline |
BufferObject destructor.
Definition at line 116 of file GLUP_buffer_object.h.
|
static |
Active_Units a unit.
| [in] | unit | a unit id (either a texture unit or a buffer unit, depending on default buffer type). |
| void GLUP::BufferObject::bind | ( | GLuint | unit = 0 | ) |
Binds this buffer to a unit.
Calls active_unit(unit).
| [in] | unit | a unit id (either a texture unit or a buffer unit, depending on default buffer type). If 0, use currently active unit. |
|
inline |
Creates an uninitialized BufferObject or updates an initialized one with new data.
| [in] | v | a geogram vector with the data |
| [in] | unit | a unit this buffer will be bound to, or 0 if currently active unit should be used instead |
Definition at line 222 of file GLUP_buffer_object.h.
|
inline |
Creates an uninitialized BufferObject or updates an initialized one with new data.
| [in] | v | a STL vector with the data |
| [in] | unit | a unit this buffer will be bound to, or 0 if currently active unit should be used instead |
Definition at line 208 of file GLUP_buffer_object.h.
|
inline |
Creates an uninitialized BufferObject or updates an initialized one with new data.
| [in] | nb | number of items |
| [in] | data | a pointer to a contiguous array of nb items |
| [in] | unit | a unit this buffer will be bound to, or 0 if currently active unit should be used instead |
Definition at line 174 of file GLUP_buffer_object.h.
|
inlineprotected |
Definition at line 358 of file GLUP_buffer_object.h.
|
inlineprotected |
Definition at line 334 of file GLUP_buffer_object.h.
|
inlineprotected |
Definition at line 268 of file GLUP_buffer_object.h.
|
static |
Gets the default type for BufferObjects.
|
inlinestaticprotected |
Definition at line 394 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 390 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 389 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 395 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 391 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 396 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 392 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 397 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 393 of file GLUP_buffer_object.h.
|
static |
Initializes static class variables.
Needs to be called after OpenGL is initialized and before any BufferObject is created.
|
inline |
Tests whether a BufferObject is initialized.
| true | if this BufferObject is initialized, that is, has associated data in GPU memory |
| false | otherwise |
Definition at line 134 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 384 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 380 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 379 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 385 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 381 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 386 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 382 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 387 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 383 of file GLUP_buffer_object.h.
| void GLUP::BufferObject::reset | ( | ) |
Resets a BufferObject.
Releases all memory and objects allocated on the GPU by this BufferObject.
|
static |
Sets a program uniform buffer unit.
unit is interpreted either as a texture unit or a SSBO binding point, depending on default_type().
| [in] | program | the OpenGL program id |
| [in] | name | a string with the name of the uniform variable |
| [in] | unit | the unit |
|
inline |
Gets the type of a BufferObject.
Definition at line 124 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 404 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 400 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 399 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 405 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 401 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 406 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 402 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 407 of file GLUP_buffer_object.h.
|
inlinestaticprotected |
Definition at line 403 of file GLUP_buffer_object.h.