40 #ifndef GEOGRAM_GFX_GLUP_GLUP_CONTEXT
41 #define GEOGRAM_GFX_GLUP_GLUP_CONTEXT
54 #ifdef GEO_GL_NO_DOUBLES
55 typedef double GLdouble;
67 static constexpr
GLUPprimitive GLUP_THICK_LINES = GLUP_RESERVED_PRIMITIVE_1;
98 GLfloat out[16],
const GLfloat m1[16],
const GLfloat m2[16]
107 GLdouble out[16],
const GLdouble m1[16],
const GLdouble m2[16]
119 GLfloat out[4],
const GLfloat m[16],
const GLfloat v[4]
133 GLfloat out[4],
const GLfloat m[16],
const GLfloat v[4]
147 GLdouble out[4],
const GLdouble m[16],
const GLdouble v[4]
157 GLdouble out[4],
const GLdouble m[16],
const GLdouble v[4]
238 to[i] = GLfloat(from[i]);
250 to[i] = GLdouble(from[i]);
260 GLfloat s = 1.0f / ::sqrtf(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]);
282 static const int MAX_DEPTH=16;
298 return stack_[top_].data();
306 GLdouble* from = top();
308 GLdouble* to = top();
341 static const index_t IMMEDIATE_BUFFER_SIZE = 65536;
348 GLUP_VERTEX_ATTRIBUTE = 0,
349 GLUP_COLOR_ATTRIBUTE = 1,
350 GLUP_TEX_COORD_ATTRIBUTE = 2,
351 GLUP_NORMAL_ATTRIBUTE = 3,
352 GLUP_VERTEX_ID_ATTRIBUTE = 4
378 glDeleteBuffers(1, &VBO_);
384 data_ =
new GLfloat[dim * IMMEDIATE_BUFFER_SIZE];
434 copy_vector(element_ptr(v), current_, dimension());
448 copy_vector(element_ptr(to), element_ptr(from), dimension());
464 element_ptr(to), from_buffer.
element_ptr(from), dimension()
481 return IMMEDIATE_BUFFER_SIZE * dimension() *
sizeof(GLfloat);
492 return data_ + v*dimension_;
523 dimension_ = rhs.dimension_;
524 is_enabled_ = rhs.is_enabled_;
526 current_[0] = rhs.current_[0];
527 current_[1] = rhs.current_[1];
528 current_[2] = rhs.current_[2];
529 current_[3] = rhs.current_[3];
555 max_current_vertex_(0),
556 primitive_(GLUP_POINTS),
558 nb_vertices_per_primitive_(nb_vertices_per_primitive)
560 buffer[GLUP_VERTEX_ATTRIBUTE].initialize(4);
561 buffer[GLUP_COLOR_ATTRIBUTE].initialize(4);
562 buffer[GLUP_TEX_COORD_ATTRIBUTE].initialize(4);
563 buffer[GLUP_NORMAL_ATTRIBUTE].initialize(4);
566 buffer[GLUP_VERTEX_ATTRIBUTE].enable();
596 for(
index_t i=0; i<NB_IMMEDIATE_BUFFERS; ++i) {
597 buffer[i].copy(to, from);
614 if(max_current_vertex != 0) {
615 max_current_vertex_ = max_current_vertex;
617 max_current_vertex_ =
618 IMMEDIATE_BUFFER_SIZE - (
619 IMMEDIATE_BUFFER_SIZE %
620 nb_vertices_per_primitive_[primitive]
623 primitive_ = primitive;
632 for(
index_t i=0; i<NB_IMMEDIATE_BUFFERS; ++i) {
633 buffer[i].copy_current_to(current_vertex_);
645 return (current_vertex_ == max_current_vertex_);
654 current_vertex_ = new_current_vertex;
669 return current_vertex_;
676 return current_vertex_ / nb_vertices_per_primitive_[
688 return max_current_vertex_;
702 enum { NB_IMMEDIATE_BUFFERS = 4 };
703 ImmediateBuffer buffer[NB_IMMEDIATE_BUFFERS];
710 index_t* nb_vertices_per_primitive_;
735 Context* context,
const char* name
754 const std::string&
name()
const {
802 Context* context,
const char* name, T value
824 return *
reinterpret_cast<T*
>(address_);
833 *
reinterpret_cast<T*
>(address_) = val;
834 flag_uniform_buffer_as_dirty();
859 Context* context,
const char* name
869 return reinterpret_cast<const GLUPfloat*
>(address_);
883 flag_uniform_buffer_as_dirty();
884 return reinterpret_cast<GLUPfloat*
>(address_);
923 dimension_ = dimension;
940 void get(GLUPfloat* x)
const {
941 Memory::copy(x, address_,
sizeof(GLUPfloat)*dimension_);
949 void set(
const GLUPfloat* x) {
950 Memory::copy(address_, x,
sizeof(GLUPfloat)*dimension_);
951 flag_uniform_buffer_as_dirty();
962 if(dimension_ == 4) {
963 reinterpret_cast<GLUPfloat*
>(address_)[3] = 1.0f;
965 flag_uniform_buffer_as_dirty();
1023 nb_elements_per_primitive(0),
1024 primitive_elements(nullptr),
1025 vertex_gather_mode(false),
1026 implemented(false) {
1036 GL_primitive = rhs.GL_primitive;
1038 elements_VBO = rhs.elements_VBO;
1039 nb_elements_per_primitive = rhs.nb_elements_per_primitive;
1040 primitive_elements = rhs.primitive_elements;
1041 vertex_gather_mode = rhs.vertex_gather_mode;
1042 implemented = rhs.implemented;
1052 for(
auto& it : shader_map) {
1053 if(it.second != 0) {
1054 glDeleteProgram(it.second);
1058 if(elements_VBO != 0) {
1059 glDeleteBuffers(1, &elements_VBO);
1067 bool program_is_initialized(ShaderKey k)
const {
1068 return (shader_map.find(k) != shader_map.end());
1071 GLuint program(ShaderKey k)
const {
1072 auto it = shader_map.find(k);
1073 return ((it == shader_map.end()) ? 0 : it->second);
1076 GLenum GL_primitive;
1077 std::map<ShaderKey, GLuint> shader_map;
1079 GLuint elements_VBO;
1080 index_t nb_elements_per_primitive;
1082 bool vertex_gather_mode;
1154 copy_vector(matrix_stack_[matrix_mode_].top(), m, 16);
1155 flag_matrices_as_dirty();
1165 copy_vector(matrix_stack_[matrix_mode_].top(), m, 16);
1166 flag_matrices_as_dirty();
1175 flag_matrices_as_dirty();
1186 GLdouble product[16];
1188 load_matrix(product);
1197 matrix_stack_[matrix_mode_].push();
1204 matrix_stack_[matrix_mode_].pop();
1205 flag_matrices_as_dirty();
1215 matrix_mode_ = matrix;
1224 return matrix_mode_;
1236 GLfloat x, GLfloat y, GLfloat z=0.0f, GLfloat w=1.0f
1238 immediate_state_.buffer[GLUP_VERTEX_ATTRIBUTE].set_current(x,y,z,w);
1239 immediate_state_.next_vertex();
1240 if(immediate_state_.buffers_are_full()) {
1241 flush_immediate_buffers();
1251 GLfloat r, GLfloat g, GLfloat b, GLfloat a = 1.0f
1253 immediate_state_.buffer[GLUP_COLOR_ATTRIBUTE].set_current(r,g,b,a);
1262 GLfloat s, GLfloat t=0.0f, GLfloat u=0.0f, GLfloat v=1.0f
1264 immediate_state_.buffer[GLUP_TEX_COORD_ATTRIBUTE].set_current(
1275 immediate_state_.buffer[GLUP_NORMAL_ATTRIBUTE].set_current(
1285 user_program_ = program;
1331 GLUPenum type,
const GLUPvoid* indices
1349 return uniform_state_;
1357 return uniform_state_;
1366 uniform_buffer_dirty_ =
true;
1375 uniform_buffer_dirty_ =
true;
1376 lighting_dirty_ =
true;
1384 uniform_buffer_dirty_ =
true;
1385 matrices_dirty_ =
true;
1396 return matrix_stack_[matrix].top();
1406 std::vector<GLSL::Source>& sources
1416 std::vector<GLSL::Source>& sources
1426 std::vector<GLSL::Source>& sources
1436 std::vector<GLSL::Source>& sources
1446 std::vector<GLSL::Source>& sources
1460 std::vector<GLSL::Source>& sources
1472 std::vector<GLSL::Source>& sources
1484 std::vector<GLSL::Source>& sources
1497 GLUPbitfield toggles_state,
1498 GLUPbitfield toggles_undetermined=0
1517 return immediate_state_;
1666 GLUPprimitive glup_primitive, GLenum gl_primitive, GLuint program,
1667 bool bind_attrib_loc_and_link =
true
1685 GLUPprimitive glup_primitive, GLenum gl_primitive, GLuint program
1709 GLUPprimitive glup_primitive, GLenum gl_primitive, GLuint program,
1710 index_t nb_elements_per_glup_primitive,
1719 if(uniform_buffer_dirty_) {
1720 do_update_uniform_buffer();
1765 PrimitiveInfo::ShaderKey toggles_config
1767 if(toggles_config == (1 << GLUP_PICKING)) {
1768 setup_shaders_source_for_toggles(
1769 (1 << GLUP_PICKING),
1770 (1 << GLUP_CLIPPING)
1773 setup_shaders_source_for_toggles(GLUPbitfield(toggles_config));
1849 for(
index_t lv=0; lv<nb_v; ++lv) {
1850 if(v_is_visible_[first_v+lv]) {
1851 result = result | (1u << lv);
1868 const GLUPfloat* eqn = world_clip_plane_;
1869 const GLUPfloat* p1 = immediate_state_.buffer[0].element_ptr(v1);
1870 const GLUPfloat* p2 = immediate_state_.buffer[0].element_ptr(v2);
1872 GLUPfloat t = -eqn[3] -(
1879 eqn[0]*(p2[0]-p1[0]) +
1880 eqn[1]*(p2[1]-p1[1]) +
1881 eqn[2]*(p2[2]-p1[2]) ;
1883 if(fabs(
double(d)) < 1e-6) {
1889 GLUPfloat s = 1.0f - t;
1891 isect_vertex_attribute_[0][4*vi+0] = s*p1[0] + t*p2[0];
1892 isect_vertex_attribute_[0][4*vi+1] = s*p1[1] + t*p2[1];
1893 isect_vertex_attribute_[0][4*vi+2] = s*p1[2] + t*p2[2];
1894 isect_vertex_attribute_[0][4*vi+3] = 1.0f;
1897 if(immediate_state_.buffer[i].is_enabled()) {
1898 const GLUPfloat* a1 =
1899 immediate_state_.buffer[i].element_ptr(v1);
1900 const GLUPfloat* a2 =
1901 immediate_state_.buffer[i].element_ptr(v2);
1902 isect_vertex_attribute_[i][4*vi+0] = s*a1[0] + t*a2[0];
1903 isect_vertex_attribute_[i][4*vi+1] = s*a1[1] + t*a2[1];
1904 isect_vertex_attribute_[i][4*vi+2] = s*a1[2] + t*a2[2];
1905 isect_vertex_attribute_[i][4*vi+3] = s*a1[3] + t*a2[3];
1926 if(program != 0 && program != latest_program_) {
1927 glUseProgram(program);
1928 latest_program_ = program;
1929 copy_uniform_state_to_current_program();
1931 glUseProgram(program);
1948 GLuint default_program_;
1949 GLuint uniform_buffer_;
1950 GLuint uniform_binding_point_;
1951 GLint uniform_buffer_size_;
1952 bool uniform_buffer_dirty_;
1958 bool lighting_dirty_;
1961 GLUPmatrix matrix_mode_;
1963 bool matrices_dirty_;
1973 index_t nb_vertices_per_primitive_[GLUP_NB_PRIMITIVES];
1991 GLuint user_program_;
1993 PrimitiveInfo::ShaderKey toggles_config_;
1996 GLUPbitfield toggles_source_state_;
1997 GLUPbitfield toggles_source_undetermined_;
1999 bool precompile_shaders_;
2001 bool use_core_profile_;
2002 bool use_ES_profile_;
2023 bool v_is_visible_[IMMEDIATE_BUFFER_SIZE];
2030 GLUPfloat isect_vertex_attribute_[3][12*4];
Utilities for manipulating GLSL shaders.
GLUP: GL Useful Primitives.
void GLUP_API glupDeleteVertexArrays(GLUPsizei n, const GLUPuint *arrays)
Deletes vertex array objects.
GLUPprimitive
Symbolic values corresponding to GLUP primitive types.
void mult_matrix_vector(GLfloat out[4], const GLfloat m[16], const GLfloat v[4])
Computes the product of a 4x4 matrix and a vector.
void load_identity_matrix(GLfloat out[16])
Resets a matrix to the identity matrix.
GLUPattribute
Index of an ImmediateBuffer in the ImmediateState.
GLboolean invert_matrix(GLfloat inv[16], const GLfloat m[16])
Computes the inverse of a 4x4 matrix.
void normalize_vector(GLfloat v[3])
Normalizes a vector.
void mult_transpose_matrix_vector(GLfloat out[4], const GLfloat m[16], const GLfloat v[4])
Computes the product of the transpose of a 4x4 matrix and a vector.
void transpose_matrix(GLfloat m[16])
Transposes a matrix in-place.
void copy_vector(GLfloat *to, const GLfloat *from, index_t dim)
Copies a vector of floats.
void show_matrix(const GLfloat m[16])
For debugging, outputs a matrix to the standard error.
void mult_matrices(GLfloat out[16], const GLfloat m1[16], const GLfloat m2[16])
Computes the product of two 4x4 matrices.
void show_vector(const GLfloat v[4])
For debugging, outputs a vector to the standard error.
Implementation of the marching cells algorithms.
#define geo_assert(x)
Verifies that a condition is met.
#define geo_debug_assert(x)
Verifies that a condition is met.
A class that can register functions to the GLSL pseudo file system.
Vector with aligned memory allocation.
GLUP context stores a Uniform Buffer Object with state variables similar to OpenGL's fixed functional...
Context()
Context constructor.
const MarchingCell & get_marching_cell() const
Gets the MarchingCell that corresponds to the current primitive.
void setup_shaders_source_for_toggles_config(PrimitiveInfo::ShaderKey toggles_config)
Sets the string that describes the settings of the toggles for a given configuration.
virtual void get_marching_cells_pseudo_file(std::vector< GLSL::Source > &sources)
Gets the content of the virtual file GLUP/current_profile/marching_cells.h.
virtual void update_matrices()
Updates the matrices in the uniform state from the matrices in the stacks.
ImmediateState & immediate_state()
Gets the immediate state.
virtual void done_draw(GLUPprimitive primitive)
This function is called right after rendering primitives. It is called by end(), draw_arrays() and dr...
virtual void set_primitive_info(GLUPprimitive glup_primitive, GLenum gl_primitive, GLuint program, bool bind_attrib_loc_and_link=true)
Initializes the PrimitiveInfo associated with a given GLUP primitive.
virtual void get_geometry_shader_preamble_pseudo_file(std::vector< GLSL::Source > &sources)
Gets the content of the virtual file GLUP/current_profile/geometry_shader_preamble....
void set_user_program(GLuint program)
Sets the user program, to be used instead of the default GLUP programs for drawing the primitives.
void immediate_color(GLfloat r, GLfloat g, GLfloat b, GLfloat a=1.0f)
Specifies the current color for the immediate mode buffers.
void mult_matrix(const GLdouble m[16])
Post-multiplies the top of the current matrix stack with the specified matrix.
virtual Memory::pointer get_state_variable_address(const char *name)
Gets a pointer to the representation of a uniform state variable in host memory from its (unqualified...
virtual void bind_uniform_state(GLuint program)
Binds GLUP uniform state to a program.
virtual void setup_primitives()
Setups the programs and VAOs used for each primitive.
virtual void setup_GLUP_THICK_LINES()
Setups GLSL programs for lines with width > 1.
~Context() override
Context destructor.
virtual void setup_shaders_source_for_primitive(GLUPprimitive primitive)
Sets the configurable GLSL sources for a given primitive type.
static const char * uniform_state_declaration()
Gets the GLSL declaration of GLUP uniform state.
void load_matrix(const GLdouble m[16])
Replaces the top of the current matrix stack with the specified matrix.
void setup_shaders_source_for_toggles(GLUPbitfield toggles_state, GLUPbitfield toggles_undetermined=0)
Sets the string that describes the settings of the toggles for a given configuration.
virtual const char * profile_name() const =0
Gets the profile name associated with this context.
GLUPdouble * get_matrix(GLUPmatrix matrix)
Gets a pointer to the values of the matrix at the top of a given stack.
virtual void setup_GLUP_PRISMS()
Setups GLSL programs for prisms.
GLUPfloat * world_clip_plane_
Cached pointer to uniform state variable.
std::string primitive_declaration(GLUPprimitive prim) const
Gets the GLSL declaration of the constant that indicates the current primitive.
void pop_matrix()
Pops the top of the current stack matrix.
void immediate_vertex(GLfloat x, GLfloat y, GLfloat z=0.0f, GLfloat w=1.0f)
Creates a new vertex in the immediate mode buffers.
void create_vertex_id_VBO()
Creates a vertex buffer object with 16 bits integers between 0 and 65535.
virtual void update_lighting()
Updates the lighting in the uniform state.
index_t get_config(index_t first_v, index_t nb_v)
Assemble the configuration code of a primitive relative to the clipping plane.
virtual void setup_GLUP_TETRAHEDRA()
Setups GLSL programs for tetrahedra.
void compute_intersection(index_t v1, index_t v2, index_t vi)
Computes the intersection between the clipping plane and a segment.
void shrink_cells_in_immediate_buffers()
Shrinks the cells in the immediate buffer.
virtual void setup_GLUP_LINES()
Setups GLSL programs for lines.
virtual void setup_state_variables()
Initializes the representation of the uniform state.
std::map< std::string, GLsizei > variable_to_offset_
Used by GPU-side uniform buffer.
const UniformState & uniform_state() const
Gets the uniform state.
static const char * glup_primitive_name(GLUPprimitive prim)
Gets the name of a primitive by GLUPprimitive.
virtual void prepare_to_draw(GLUPprimitive primitive)
This function is called before starting to render primitives. It is called by begin(),...
void flag_uniform_buffer_as_dirty()
Indicates that the OpenGL representation of the uniform state is no longer in sync with the local cop...
virtual void begin(GLUPprimitive primitive)
Begins rendering in immediate mode.
GLUPmatrix get_matrix_mode() const
Gets the current matrix stack.
bool extension_is_supported(const std::string &extension)
Tests whether an OpenGL extension is supported.
void classify_vertices_in_immediate_buffers()
Updates v_is_visible_[] according to current clipping plane.
GLuint latest_program_
Latest used GLSL program.
virtual void flush_immediate_buffers()
Flushes the immediate mode buffers.
virtual void stream_immediate_buffers()
Sends all the active immediate buffers to the GPU.
virtual void draw_elements(GLUPprimitive primitive, GLUPsizei count, GLUPenum type, const GLUPvoid *indices)
Draws primitives using current OpenGL array bindings.
void use_program(GLuint program)
A wrapper around glUseProgram that tests whether uniform state needs to be sent to the program.
virtual void set_primitive_info_vertex_gather_mode(GLUPprimitive glup_primitive, GLenum gl_primitive, GLuint program)
Initializes the PrimitiveInfo associated with a given GLUP primitive in vertex-gather mode.
GLuint vertex_id_VBO_
A vertex buffer object with 65536 16 bits integers.
virtual void get_tess_control_shader_preamble_pseudo_file(std::vector< GLSL::Source > &sources)
Gets the content of the virtual file GLUP/current_profile/tess_control_shader_preamble....
virtual void set_primitive_info_immediate_index_mode(GLUPprimitive glup_primitive, GLenum gl_primitive, GLuint program, index_t nb_elements_per_glup_primitive, index_t *element_indices)
Initializes the PrimitiveInfo associated with a given GLUP primitive in immediate mode when an elemen...
void immediate_normal(GLfloat x, GLfloat y, GLfloat z)
Specifies the current normal vector for the immediate mode buffers.
virtual void setup_GLUP_PYRAMIDS()
Setups GLSL programs for pyramids.
virtual void setup_GLUP_SPHERES()
Setups GLSL programs for spheres.
UniformState & uniform_state()
Gets the uniform state.
virtual void get_primitive_pseudo_file(std::vector< GLSL::Source > &sources)
Gets the content of the virtual file GLUP/current_profile/primitive.h.
virtual void setup_GLUP_CONNECTORS()
Setups GLSL programs for connectors.
virtual void setup_GLUP_HEXAHEDRA()
Setups GLSL programs for hexahedra.
virtual void get_fragment_shader_preamble_pseudo_file(std::vector< GLSL::Source > &sources)
Gets the content of the virtual file GLUP/current_profile/fragment_shader_preamble....
bool cell_is_clipped(index_t first_v)
Tests whether the cell starting at a given vertex in the immediate buffer is clipped,...
virtual void do_update_uniform_buffer()
Copies GLUP uniform state to OpenGL.
void set_matrix_mode(GLUPmatrix matrix)
Sets the current matrix stack.
virtual void get_vertex_shader_preamble_pseudo_file(std::vector< GLSL::Source > &sources)
Gets the content of the virtual file GLUP/current_profile/vertex_shader_preamble.h.
void load_matrix(const GLfloat m[16])
Replaces the top of the current matrix stack with the specified matrix.
void update_toggles_config()
Updates the toggles_config_ state variable from the individual state of each toggle.
virtual void setup_GLUP_TRIANGLES()
Setups GLSL programs for triangles.
virtual void get_tess_evaluation_shader_preamble_pseudo_file(std::vector< GLSL::Source > &sources)
Gets the content of the virtual file GLUP/current_profile/tess_evaluation_shader_preamble....
virtual void setup_GLUP_QUADS()
Setups GLSL programs for quads.
virtual bool primitive_supports_array_mode(GLUPprimitive prim) const
Tests whether a given GLUP primitive supports array mode.
virtual void setup()
Creates the uniform state and GLSL programs.
void immediate_tex_coord(GLfloat s, GLfloat t=0.0f, GLfloat u=0.0f, GLfloat v=1.0f)
Specifies the current texture coordinates for the immediate mode buffers.
void flag_matrices_as_dirty()
Indicates that cached matrix information needs to be recomputed.
virtual void setup_immediate_buffers()
Set-ups the buffers for immediate rendering.
virtual void end()
Ends rendering in immediate mode.
void bind_immediate_state_buffers_to_VAO()
Binds the VBOs associated with the immediate state buffers to the currently bound VAO.
void load_identity()
Replaces the top of the current matrix stack with the identity matrix.
void push_matrix()
Pushes a copy of the top of the current stack matrix onto the current stack matrix.
virtual void update_base_picking_id(GLint new_value)
Updates the base picking id and sends it to OpenGL.
void update_uniform_buffer()
Copies GLUP uniform state to OpenGL if required.
void create_CPU_side_uniform_buffer()
Creates a buffer for uniform variables for implementations that do not support uniform buffer objects...
virtual void get_toggles_pseudo_file(std::vector< GLSL::Source > &sources)
Gets the content of the virtual file GLUP/current_profile/toggles.h.
void create_program_if_needed(GLUPprimitive primitive)
Creates the GLSL shader that corresponds to the specified primitive and current toggles configuration...
virtual void copy_uniform_state_to_current_program()
Copies the uniform state from client-side memory into the currently bound program,...
virtual void setup_GLUP_POINTS()
Setups GLSL programs for points.
void flag_lighting_as_dirty()
Indicates that cached lighting information needs to be recomputed.
virtual void draw_arrays(GLUPprimitive primitive, GLUPint first, GLUPsizei count)
Draws primitives using current OpenGL array bindings.
A GLUP state variable that contains an array of floating points. This concerns both vectors and matri...
const GLUPfloat * get_pointer() const
Gets a pointer to the variable.
FloatsArrayStateVariable()
FloatsArrayStateVariable default constructor.
FloatsArrayStateVariable(Context *context, const char *name)
FloatsArrayStateVariable constructor.
GLUPfloat * get_pointer()
Gets a modifiable pointer to the variable.
Implements the MarchingCells algorithm.
void push()
Pushes a copy of the top matrix.
MatrixStack()
MatrixStack constructor.
void pop()
Removes a matrix from the top of the stack.
GLdouble * top()
Gets the matrix on the top of the stack.
Base class for representing GLUP state variables.
void flag_uniform_buffer_as_dirty()
Indicates that the variables in the context need to be sent to OpenGL.
StateVariableBase()
StateVariableBase default constructor.
Memory::pointer address() const
Gets the address of the StateVariableBase.
StateVariableBase(Context *context, const char *name)
StateVariableBase constructor.
const std::string & name() const
Gets the name of this StateVariableBase.
void initialize(Context *context, const char *name)
Initializes a StateVariableBase.
A GLUP state variable of a given type.
void initialize(Context *context, const char *name, T value)
Initializes a StateVariable.
StateVariable(Context *context, const char *name, T value)
StateVariableBase constructor.
void set(T val)
Sets the value.
T get() const
Gets the value.
StateVariable()
StateVariable default constructor.
A GLUP state variable that contains a vector.
VectorStateVariable(Context *context, const char *name, index_t dimension)
VectorStateVariable constructor.
void get(GLUPfloat *x) const
Gets the value.
index_t dimension() const
Gets the dimension.
void set(const GLUPfloat *x)
Sets the value.
VectorStateVariable()
VectorStateVariable default constructor.
void initialize(Context *context, const char *name, index_t dimension)
Initializes a VectorStateVariable.
void clear()
clears the vector to its default value.
Common include file, providing basic definitions. Should be included before anything else by all head...
void initialize()
Initializes the command line framework.
std::string extension(const std::string &path)
Gets a path extension.
unsigned char byte
Unsigned byte type.
byte * pointer
Pointer to unsigned byte(s)
void clear(void *addr, size_t size)
Clears a memory block.
void copy(void *to, const void *from, size_t size)
Copies a memory block.
Global Vorpaline namespace.
geo_index_t index_t
The type for storing and manipulating indices.
Stores the programs and vertex array object used to display a primitive of a given type.
~PrimitiveInfo()
PrimitiveInfo destructor.
PrimitiveInfo()
PrimitiveInfo constructor.
PrimitiveInfo(const PrimitiveInfo &rhs)
PrimitiveInfo copy constructor.