Graphite  Version 3
An experimental 3D geometry processing program
GLUP::ImmediateBuffer Class Reference

A buffer used by GLUP in immediate mode. More...

#include <geogram_gfx/GLUP/GLUP_context.h>

Public Member Functions

 ImmediateBuffer ()
 
 ~ImmediateBuffer ()
 
void initialize (index_t dim)
 
void enable ()
 Enables this ImmediateBuffer.
 
void disable ()
 Disables this ImmediateBuffer.
 
bool is_enabled () const
 Tests whether this ImmediateBuffer is enabled. More...
 
void set_current (GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 Sets the current attribute value. More...
 
void copy_current_to (index_t v)
 Copies the current attribute value to a specified vertex in this buffer. More...
 
void copy (index_t to, index_t from)
 Copies this attribute from a vertex to another one. More...
 
void copy (index_t to, ImmediateBuffer &from_buffer, index_t from)
 Copies this attribute from another attribute. More...
 
index_t dimension () const
 Gets the dimension of the attribute. More...
 
size_t size_in_bytes () const
 Gets the size of the memory used by the buffer. More...
 
GLfloat * element_ptr (index_t v)
 Gets a pointer to one attribute value by index. More...
 
GLfloat * data ()
 Gets a pointer to the data. More...
 
GLuint & VBO ()
 Gets the Vertex Buffer Object. More...
 
 ImmediateBuffer (const ImmediateBuffer &rhs)
 ImmediateBuffer copy constructor. More...
 

Detailed Description

A buffer used by GLUP in immediate mode.

Definition at line 358 of file GLUP_context.h.

Constructor & Destructor Documentation

◆ ImmediateBuffer() [1/2]

GLUP::ImmediateBuffer::ImmediateBuffer ( )
inline

ImmediateBuffer constructor.

Definition at line 365 of file GLUP_context.h.

◆ ~ImmediateBuffer()

GLUP::ImmediateBuffer::~ImmediateBuffer ( )
inline

ImmediateBuffer destructor.

Definition at line 375 of file GLUP_context.h.

◆ ImmediateBuffer() [2/2]

GLUP::ImmediateBuffer::ImmediateBuffer ( const ImmediateBuffer rhs)
inline

ImmediateBuffer copy constructor.

Parameters
[in]rhsthe ImmediateBuffer to be copied

Should be only called with uninitialized ImmediateBuffer (else triggers an assertion failure).

Definition at line 519 of file GLUP_context.h.

Member Function Documentation

◆ copy() [1/2]

void GLUP::ImmediateBuffer::copy ( index_t  to,
ImmediateBuffer from_buffer,
index_t  from 
)
inline

Copies this attribute from another attribute.

Parameters
[in]toindex of the destination vertex
[in]from_bufferthe source buffer
[in]fromindex of the source vertex
Precondition
to < IMMEDIATE_BUFFER_SIZE && from < IMMEDIATE_BUFFER_SIZE

Definition at line 459 of file GLUP_context.h.

◆ copy() [2/2]

void GLUP::ImmediateBuffer::copy ( index_t  to,
index_t  from 
)
inline

Copies this attribute from a vertex to another one.

Parameters
[in]toindex of the destination vertex
[in]fromindex of the source vertex
Precondition
to < IMMEDIATE_BUFFER_SIZE && from < IMMEDIATE_BUFFER_SIZE

Definition at line 444 of file GLUP_context.h.

◆ copy_current_to()

void GLUP::ImmediateBuffer::copy_current_to ( index_t  v)
inline

Copies the current attribute value to a specified vertex in this buffer.

Parameters
[in]vthe vertex index
Precondition
v < IMMEDIATE_BUFFER_SIZE

Definition at line 431 of file GLUP_context.h.

◆ data()

GLfloat* GLUP::ImmediateBuffer::data ( )
inline

Gets a pointer to the data.

Returns
a pointer to the first attribute. All the storage is contiguous in memory.

Definition at line 500 of file GLUP_context.h.

◆ dimension()

index_t GLUP::ImmediateBuffer::dimension ( ) const
inline

Gets the dimension of the attribute.

Returns
the number of components of the attribute

Definition at line 472 of file GLUP_context.h.

◆ element_ptr()

GLfloat* GLUP::ImmediateBuffer::element_ptr ( index_t  v)
inline

Gets a pointer to one attribute value by index.

Parameters
[in]vindex of the vertex
Returns
a pointer to the attribute, i.e. an array of dimension() GLfloats

Definition at line 490 of file GLUP_context.h.

◆ is_enabled()

bool GLUP::ImmediateBuffer::is_enabled ( ) const
inline

Tests whether this ImmediateBuffer is enabled.

Return values
trueif this ImmediateBuffer is enabled
falseotherwise

Definition at line 408 of file GLUP_context.h.

◆ set_current()

void GLUP::ImmediateBuffer::set_current ( GLfloat  x,
GLfloat  y,
GLfloat  z,
GLfloat  w 
)
inline

Sets the current attribute value.

Parameters
[in]x,y,z,wthe component of the current attribute

Components past the dimension of the attribute are ignored (e.g., if dimension is 2, z and w are ignored).

Definition at line 418 of file GLUP_context.h.

◆ size_in_bytes()

size_t GLUP::ImmediateBuffer::size_in_bytes ( ) const
inline

Gets the size of the memory used by the buffer.

Returns
the size of the buffer in bytes.

Definition at line 480 of file GLUP_context.h.

◆ VBO()

GLuint& GLUP::ImmediateBuffer::VBO ( )
inline

Gets the Vertex Buffer Object.

Returns
a modifiable reference to the Id of the Vertex Buffer Object. Can be zero if no VBO is used.

Definition at line 509 of file GLUP_context.h.


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