Geogram  Version 1.9.1-rc
A programming library of geometric algorithms
GLUP::ImmediateState Class Reference

Stores all the buffers used to implement the immediate-mode interface. More...

#include <geogram_gfx/GLUP/GLUP_context.h>

Public Types

enum  { NB_IMMEDIATE_BUFFERS = 4 }
 

Public Member Functions

 ImmediateState (index_t *nb_vertices_per_primitive)
 ImmediateState constructor. More...
 
 ~ImmediateState ()
 ImmediateState destructor.
 
GLuint & VAO ()
 Gets the Vertex Array Object. More...
 
void copy_element (index_t to, index_t from)
 Copies an element, i.e. all the attributes attached to a vertex. More...
 
void begin (GLUPprimitive primitive, index_t max_current_vertex=0)
 Configures the immediate state for rendering primitives of a given type. More...
 
void next_vertex ()
 Advances to the next vertex. More...
 
bool buffers_are_full ()
 Tests whether the buffers are full. More...
 
void reset (index_t new_current_vertex=0)
 Resets the current vertex index. More...
 
GLUPprimitive primitive () const
 Gets the primitive currently rendered, i.e. the argument to the latest invocation of begin()
 
index_t nb_vertices () const
 Gets the number of vertices stored in the buffers.
 
index_t nb_primitives () const
 Gets the number of primitives stored in the buffers.
 
index_t max_current_vertex () const
 Gets the maximum number of vertices in the buffer before the buffer is flushed. More...
 
void set_current_vertex (index_t v)
 Sets the current vertex. More...
 

Public Attributes

ImmediateBuffer buffer [NB_IMMEDIATE_BUFFERS]
 

Detailed Description

Stores all the buffers used to implement the immediate-mode interface.

Definition at line 545 of file GLUP_context.h.

Constructor & Destructor Documentation

◆ ImmediateState()

GLUP::ImmediateState::ImmediateState ( index_t nb_vertices_per_primitive)
inline

ImmediateState constructor.

Parameters
[in]nb_vertices_per_primitivea pointer to an array of index_t of size GLUP_NB_PRIMITIVES that indicates for each primitive the number of vertices (3 for GLUP_TRIANGLES, 4 for GLUP_QUADS etc...).

Definition at line 553 of file GLUP_context.h.

Member Function Documentation

◆ begin()

void GLUP::ImmediateState::begin ( GLUPprimitive  primitive,
index_t  max_current_vertex = 0 
)
inline

Configures the immediate state for rendering primitives of a given type.

Parameters
[in]primitivetype of the primitives to be rendered
[in]max_current_vertexoptional maximum index of a vertex index in immediate buffer before flushing. Computed from primitive if unspecified. It is used by primitives that need additional vertices to be generated in the immediate buffer (e.g., GLUP_THICK_LINES in GLUP_ES profile).

Definition at line 612 of file GLUP_context.h.

◆ buffers_are_full()

bool GLUP::ImmediateState::buffers_are_full ( )
inline

Tests whether the buffers are full.

When buffers are full, their contents need to be sent to OpenGL before calling reset(). These operations are done by the Context.

Definition at line 644 of file GLUP_context.h.

◆ copy_element()

void GLUP::ImmediateState::copy_element ( index_t  to,
index_t  from 
)
inline

Copies an element, i.e. all the attributes attached to a vertex.

Parameters
[in]toindex of the destination vertex
[in]fromindex of the source vertex

Only attributes that are enabled are copied.

Definition at line 595 of file GLUP_context.h.

◆ max_current_vertex()

index_t GLUP::ImmediateState::max_current_vertex ( ) const
inline

Gets the maximum number of vertices in the buffer before the buffer is flushed.

This number depends on the number of vertices per primitive.

Definition at line 687 of file GLUP_context.h.

◆ next_vertex()

void GLUP::ImmediateState::next_vertex ( )
inline

Advances to the next vertex.

This copies all the current values of all enabled attributes to the current vertex position.

Definition at line 631 of file GLUP_context.h.

◆ reset()

void GLUP::ImmediateState::reset ( index_t  new_current_vertex = 0)
inline

Resets the current vertex index.

Parameters
[in]new_current_vertexoptional new value of the current vertex.

Definition at line 653 of file GLUP_context.h.

◆ set_current_vertex()

void GLUP::ImmediateState::set_current_vertex ( index_t  v)
inline

Sets the current vertex.

This defines the number of stored vertices in this buffer.

Parameters
[in]vthe index of the current vertex.

Definition at line 697 of file GLUP_context.h.

◆ VAO()

GLuint& GLUP::ImmediateState::VAO ( )
inline

Gets the Vertex Array Object.

Returns
a modifiable reference to the Id of the Vertex Array Object. Can be 0 if no VAO is used.

Definition at line 584 of file GLUP_context.h.


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