Geogram  Version 1.9.1-rc
A programming library of geometric algorithms
GLUP_context.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2000-2022 Inria
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  * * Neither the name of the ALICE Project-Team nor the names of its
14  * contributors may be used to endorse or promote products derived from this
15  * software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  *
29  * Contact: Bruno Levy
30  *
31  * https://www.inria.fr/fr/bruno-levy
32  *
33  * Inria,
34  * Domaine de Voluceau,
35  * 78150 Le Chesnay - Rocquencourt
36  * FRANCE
37  *
38  */
39 
40 #ifndef GEOGRAM_GFX_GLUP_GLUP_CONTEXT
41 #define GEOGRAM_GFX_GLUP_GLUP_CONTEXT
42 
44 #include <geogram_gfx/GLUP/GLUP.h>
46 #include <geogram_gfx/basic/GLSL.h>
47 #include <map>
48 
54 #ifdef GEO_GL_NO_DOUBLES
55 typedef double GLdouble;
56 #endif
57 
67 static constexpr GLUPprimitive GLUP_THICK_LINES = GLUP_RESERVED_PRIMITIVE_1;
68 
69 namespace GLUP {
70  using namespace GEO;
71 
80  GLboolean invert_matrix(GLfloat inv[16], const GLfloat m[16]);
81 
90  GLboolean invert_matrix(GLdouble inv[16], const GLdouble m[16]);
91 
98  GLfloat out[16], const GLfloat m1[16], const GLfloat m2[16]
99  );
100 
107  GLdouble out[16], const GLdouble m1[16], const GLdouble m2[16]
108  );
109 
119  GLfloat out[4], const GLfloat m[16], const GLfloat v[4]
120  );
121 
122 
133  GLfloat out[4], const GLfloat m[16], const GLfloat v[4]
134  );
135 
136 
147  GLdouble out[4], const GLdouble m[16], const GLdouble v[4]
148  );
149 
157  GLdouble out[4], const GLdouble m[16], const GLdouble v[4]
158  );
159 
165  void transpose_matrix(GLfloat m[16]);
166 
172  void transpose_matrix(GLdouble m[16]);
173 
178  void show_matrix(const GLfloat m[16]);
179 
184  void show_matrix(const GLdouble m[16]);
185 
190  void show_vector(const GLfloat v[4]);
191 
196  void show_vector(const GLdouble v[4]);
197 
202  void load_identity_matrix(GLfloat out[16]);
203 
208  void load_identity_matrix(GLdouble out[16]);
209 
216  inline void copy_vector(GLfloat* to, const GLfloat* from, index_t dim) {
217  Memory::copy(to, from, sizeof(GLfloat)*dim);
218  }
219 
226  inline void copy_vector(GLdouble* to, const GLdouble* from, index_t dim) {
227  Memory::copy(to, from, sizeof(GLdouble)*dim);
228  }
229 
236  inline void copy_vector(GLfloat* to, const GLdouble* from, index_t dim) {
237  for(index_t i=0; i<dim; ++i) {
238  to[i] = GLfloat(from[i]);
239  }
240  }
241 
248  inline void copy_vector(GLdouble* to, const GLfloat* from, index_t dim) {
249  for(index_t i=0; i<dim; ++i) {
250  to[i] = GLdouble(from[i]);
251  }
252  }
253 
259  inline void normalize_vector(GLfloat v[3]) {
260  GLfloat s = 1.0f / ::sqrtf(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]);
261  v[0] *= s;
262  v[1] *= s;
263  v[2] *= s;
264  }
265 
266  /**********************************************************************/
267 
268  class Context;
269 
276  class MatrixStack {
277  public:
278 
282  static const int MAX_DEPTH=16;
283 
287  MatrixStack() : top_(0) {
288  load_identity_matrix(top());
289  }
290 
297  GLdouble* top() {
298  return stack_[top_].data();
299  }
300 
304  void push() {
305  geo_assert(top_ != MAX_DEPTH-1);
306  GLdouble* from = top();
307  ++top_;
308  GLdouble* to = top();
309  copy_vector(to, from, 16);
310  }
311 
316  void pop() {
317  geo_assert(top_ != 0);
318  --top_;
319  }
320 
321  protected:
322  struct Matrix {
323  GLdouble coeff[16];
324  GLdouble* data() {
325  return &coeff[0];
326  }
327  };
328 
329  private:
330  Matrix stack_[MAX_DEPTH];
331  index_t top_;
332  };
333 
334 
341  static const index_t IMMEDIATE_BUFFER_SIZE = 65536;
342 
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
353  };
354 
359 
360  public:
361 
366  data_(nullptr),
367  dimension_(0),
368  is_enabled_(false),
369  VBO_(0) {
370  }
371 
376  delete[] data_;
377  if(VBO_ != 0) {
378  glDeleteBuffers(1, &VBO_);
379  VBO_ = 0;
380  }
381  }
382 
383  void initialize(index_t dim) {
384  data_ = new GLfloat[dim * IMMEDIATE_BUFFER_SIZE];
385  dimension_ = dim;
386  is_enabled_ = true;
387  }
388 
392  void enable() {
393  is_enabled_ = true;
394  }
395 
399  void disable() {
400  is_enabled_ = false;
401  }
402 
408  bool is_enabled() const {
409  return is_enabled_;
410  }
411 
418  void set_current(GLfloat x, GLfloat y, GLfloat z, GLfloat w) {
419  current_[0] = x;
420  current_[1] = y;
421  current_[2] = z;
422  current_[3] = w;
423  }
424 
432  geo_debug_assert(v < IMMEDIATE_BUFFER_SIZE);
433  if(is_enabled()) {
434  copy_vector(element_ptr(v), current_, dimension());
435  }
436  }
437 
444  void copy(index_t to, index_t from) {
445  geo_debug_assert(to < IMMEDIATE_BUFFER_SIZE);
446  geo_debug_assert(from < IMMEDIATE_BUFFER_SIZE);
447  if(is_enabled()) {
448  copy_vector(element_ptr(to), element_ptr(from), dimension());
449  }
450  }
451 
459  void copy(index_t to, ImmediateBuffer& from_buffer, index_t from) {
460  geo_debug_assert(to < IMMEDIATE_BUFFER_SIZE);
461  geo_debug_assert(from < IMMEDIATE_BUFFER_SIZE);
462  geo_debug_assert(from_buffer.dimension() == dimension());
463  copy_vector(
464  element_ptr(to), from_buffer.element_ptr(from), dimension()
465  );
466  }
467 
472  index_t dimension() const {
473  return dimension_;
474  }
475 
480  size_t size_in_bytes() const {
481  return IMMEDIATE_BUFFER_SIZE * dimension() * sizeof(GLfloat);
482  }
483 
490  GLfloat* element_ptr(index_t v) {
491  geo_debug_assert(v < IMMEDIATE_BUFFER_SIZE);
492  return data_ + v*dimension_;
493  }
494 
500  GLfloat* data() {
501  return data_;
502  }
503 
509  GLuint& VBO() {
510  return VBO_;
511  }
512 
520  const ImmediateBuffer& rhs
521  ) {
522  data_ = rhs.data_;
523  dimension_ = rhs.dimension_;
524  is_enabled_ = rhs.is_enabled_;
525  VBO_ = rhs.VBO_;
526  current_[0] = rhs.current_[0];
527  current_[1] = rhs.current_[1];
528  current_[2] = rhs.current_[2];
529  current_[3] = rhs.current_[3];
530  geo_assert(data_ == nullptr);
531  }
532 
533  private:
534  GLfloat* data_;
535  GLfloat current_[4];
536  index_t dimension_;
537  bool is_enabled_;
538  GLuint VBO_;
539  };
540 
546  public:
553  ImmediateState(index_t* nb_vertices_per_primitive) :
554  current_vertex_(0),
555  max_current_vertex_(0),
556  primitive_(GLUP_POINTS),
557  VAO_(0),
558  nb_vertices_per_primitive_(nb_vertices_per_primitive)
559  {
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);
564 
565  // Vertex is always enabled
566  buffer[GLUP_VERTEX_ATTRIBUTE].enable();
567  }
568 
573  if(VAO_ != 0) {
574  glupDeleteVertexArrays(1, &VAO_);
575  VAO_ = 0;
576  }
577  }
578 
584  GLuint& VAO() {
585  return VAO_;
586  }
587 
595  void copy_element(index_t to, index_t from) {
596  for(index_t i=0; i<NB_IMMEDIATE_BUFFERS; ++i) {
597  buffer[i].copy(to, from);
598  }
599  }
600 
601 
612  void begin(GLUPprimitive primitive, index_t max_current_vertex=0) {
613  current_vertex_ = 0;
614  if(max_current_vertex != 0) {
615  max_current_vertex_ = max_current_vertex;
616  } else {
617  max_current_vertex_ =
618  IMMEDIATE_BUFFER_SIZE - (
619  IMMEDIATE_BUFFER_SIZE %
620  nb_vertices_per_primitive_[primitive]
621  );
622  }
623  primitive_ = primitive;
624  }
625 
631  void next_vertex() {
632  for(index_t i=0; i<NB_IMMEDIATE_BUFFERS; ++i) {
633  buffer[i].copy_current_to(current_vertex_);
634  }
635  ++current_vertex_;
636  }
637 
645  return (current_vertex_ == max_current_vertex_);
646  }
647 
653  void reset(index_t new_current_vertex = 0) {
654  current_vertex_ = new_current_vertex;
655  }
656 
662  return primitive_;
663  }
664 
669  return current_vertex_;
670  }
671 
676  return current_vertex_ / nb_vertices_per_primitive_[
677  primitive_
678  ];
679  }
680 
688  return max_current_vertex_;
689  }
690 
698  geo_debug_assert(v <= max_current_vertex_);
699  current_vertex_ = v;
700  }
701 
702  enum { NB_IMMEDIATE_BUFFERS = 4 };
703  ImmediateBuffer buffer[NB_IMMEDIATE_BUFFERS];
704 
705  private:
706  index_t current_vertex_;
707  index_t max_current_vertex_;
708  GLUPprimitive primitive_;
709  GLuint VAO_;
710  index_t* nb_vertices_per_primitive_;
711  };
712 
713 
714  /**********************************************************/
715 
720  public:
721 
725  StateVariableBase() : address_(nullptr), context_(nullptr) {
726  }
727 
735  Context* context, const char* name
736  ) {
737  initialize(context,name);
738  }
739 
747  void initialize(Context* context, const char* name);
748 
754  const std::string& name() const {
755  return name_;
756  }
757 
758  protected:
759  friend class Context;
760 
767  return address_;
768  }
769 
775 
776  Memory::pointer address_;
777  Context* context_;
778  std::string name_;
779  };
780 
785  template <class T> class StateVariable : public StateVariableBase {
786  public:
787 
792  }
793 
802  Context* context, const char* name, T value
803  ) : StateVariableBase(context, name) {
804  set(value);
805  }
806 
814  void initialize(Context* context, const char* name, T value) {
815  StateVariableBase::initialize(context, name);
816  set(value);
817  }
818 
823  T get() const {
824  return *reinterpret_cast<T*>(address_);
825  }
826 
832  void set(T val) {
833  *reinterpret_cast<T*>(address_) = val;
834  flag_uniform_buffer_as_dirty();
835  }
836  };
837 
844  public:
845 
850  }
851 
859  Context* context, const char* name
860  ) : StateVariableBase(context, name) {
861  }
862 
868  const GLUPfloat* get_pointer() const {
869  return reinterpret_cast<const GLUPfloat*>(address_);
870  }
871 
879  GLUPfloat* get_pointer() {
880  // This is a non-const pointer, therefore it will be
881  // probably modified by client code (else the 'const'
882  // version of get_pointer() would have been called).
883  flag_uniform_buffer_as_dirty();
884  return reinterpret_cast<GLUPfloat*>(address_);
885  }
886  };
887 
893  public:
894 
898  VectorStateVariable() : dimension_(0) {
899  }
900 
909  Context* context, const char* name, index_t dimension
910  ) : FloatsArrayStateVariable(context, name), dimension_(dimension) {
911  clear();
912  }
913 
921  void initialize(Context* context, const char* name, index_t dimension) {
923  dimension_ = dimension;
924  clear();
925  }
926 
931  index_t dimension() const {
932  return dimension_;
933  }
934 
940  void get(GLUPfloat* x) const {
941  Memory::copy(x, address_, sizeof(GLUPfloat)*dimension_);
942  }
943 
949  void set(const GLUPfloat* x) {
950  Memory::copy(address_, x, sizeof(GLUPfloat)*dimension_);
951  flag_uniform_buffer_as_dirty();
952  }
953 
960  void clear() {
961  Memory::clear(address_, sizeof(GLUPfloat)*dimension_);
962  if(dimension_ == 4) {
963  reinterpret_cast<GLUPfloat*>(address_)[3] = 1.0f;
964  }
965  flag_uniform_buffer_as_dirty();
966  }
967 
968  protected:
969  index_t dimension_;
970  };
971 
972 
976  struct UniformState {
979  VectorStateVariable light_vector;
980  VectorStateVariable light_half_vector;
981  StateVariable<GLfloat> point_size;
982  StateVariable<GLfloat> mesh_width;
983  StateVariable<GLfloat> cells_shrink;
984  StateVariable<GLint> picking_mode;
985  StateVariable<GLint> picking_id;
986  StateVariable<GLint> base_picking_id;
987  StateVariable<GLint> clipping_mode;
988  StateVariable<GLint> texture_mode;
989  StateVariable<GLint> texture_type;
990  StateVariable<GLfloat> alpha_threshold;
991  StateVariable<GLfloat> specular;
992  VectorStateVariable clip_plane;
993  VectorStateVariable world_clip_plane;
994  VectorStateVariable clip_clip_plane;
995  FloatsArrayStateVariable modelview_matrix;
996  FloatsArrayStateVariable modelviewprojection_matrix;
997  FloatsArrayStateVariable projection_matrix;
998  FloatsArrayStateVariable normal_matrix;
999  FloatsArrayStateVariable texture_matrix;
1000  FloatsArrayStateVariable inverse_modelviewprojection_matrix;
1001  FloatsArrayStateVariable inverse_modelview_matrix;
1002  FloatsArrayStateVariable inverse_projection_matrix;
1003  VectorStateVariable viewport;
1004  };
1005 
1006  /**********************************************************************/
1007 
1012  struct PrimitiveInfo {
1013 
1014  typedef Numeric::uint64 ShaderKey;
1015 
1020  GL_primitive(0),
1021  VAO(0),
1022  elements_VBO(0),
1023  nb_elements_per_primitive(0),
1024  primitive_elements(nullptr),
1025  vertex_gather_mode(false),
1026  implemented(false) {
1027  }
1028 
1035  PrimitiveInfo(const PrimitiveInfo& rhs) : shader_map(rhs.shader_map) {
1036  GL_primitive = rhs.GL_primitive;
1037  VAO = rhs.VAO;
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;
1043  geo_assert(GL_primitive == 0);
1044  geo_assert(nb_elements_per_primitive == 0);
1045  }
1046 
1052  for(auto& it : shader_map) {
1053  if(it.second != 0) {
1054  glDeleteProgram(it.second);
1055  it.second = 0;
1056  }
1057  }
1058  if(elements_VBO != 0) {
1059  glDeleteBuffers(1, &elements_VBO);
1060  }
1061  if(VAO != 0) {
1062  glupDeleteVertexArrays(1,&VAO);
1063  VAO = 0;
1064  }
1065  }
1066 
1067  bool program_is_initialized(ShaderKey k) const {
1068  return (shader_map.find(k) != shader_map.end());
1069  }
1070 
1071  GLuint program(ShaderKey k) const {
1072  auto it = shader_map.find(k);
1073  return ((it == shader_map.end()) ? 0 : it->second);
1074  }
1075 
1076  GLenum GL_primitive;
1077  std::map<ShaderKey, GLuint> shader_map;
1078  GLuint VAO;
1079  GLuint elements_VBO;
1080  index_t nb_elements_per_primitive;
1081  index_t* primitive_elements;
1082  bool vertex_gather_mode;
1083  bool implemented;
1084  };
1085 
1086  /**********************************************************************/
1087 
1094  public:
1103  static const char* uniform_state_declaration();
1104 
1109 
1113  ~Context() override;
1114 
1115 
1119  virtual const char* profile_name() const = 0;
1120 
1130 
1136  virtual void setup();
1137 
1145  virtual void bind_uniform_state(GLuint program);
1146 
1153  void load_matrix(const GLfloat m[16]) {
1154  copy_vector(matrix_stack_[matrix_mode_].top(), m, 16);
1155  flag_matrices_as_dirty();
1156  }
1157 
1164  void load_matrix(const GLdouble m[16]) {
1165  copy_vector(matrix_stack_[matrix_mode_].top(), m, 16);
1166  flag_matrices_as_dirty();
1167  }
1168 
1173  void load_identity() {
1174  load_identity_matrix(matrix_stack_[matrix_mode_].top());
1175  flag_matrices_as_dirty();
1176  }
1177 
1185  void mult_matrix(const GLdouble m[16]) {
1186  GLdouble product[16];
1187  mult_matrices(product,m,matrix_stack_[matrix_mode_].top());
1188  load_matrix(product);
1189  }
1190 
1196  void push_matrix() {
1197  matrix_stack_[matrix_mode_].push();
1198  }
1199 
1203  void pop_matrix() {
1204  matrix_stack_[matrix_mode_].pop();
1205  flag_matrices_as_dirty();
1206  }
1207 
1214  void set_matrix_mode(GLUPmatrix matrix) {
1215  matrix_mode_ = matrix;
1216  }
1217 
1223  GLUPmatrix get_matrix_mode() const {
1224  return matrix_mode_;
1225  }
1226 
1236  GLfloat x, GLfloat y, GLfloat z=0.0f, GLfloat w=1.0f
1237  ) {
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();
1242  }
1243  }
1244 
1251  GLfloat r, GLfloat g, GLfloat b, GLfloat a = 1.0f
1252  ) {
1253  immediate_state_.buffer[GLUP_COLOR_ATTRIBUTE].set_current(r,g,b,a);
1254  }
1255 
1262  GLfloat s, GLfloat t=0.0f, GLfloat u=0.0f, GLfloat v=1.0f
1263  ) {
1264  immediate_state_.buffer[GLUP_TEX_COORD_ATTRIBUTE].set_current(
1265  s,t,u,v
1266  );
1267  }
1268 
1274  void immediate_normal(GLfloat x, GLfloat y, GLfloat z) {
1275  immediate_state_.buffer[GLUP_NORMAL_ATTRIBUTE].set_current(
1276  x,y,z,0.0f
1277  );
1278  }
1279 
1284  void set_user_program(GLuint program) {
1285  user_program_ = program;
1286  }
1287 
1293  virtual void begin(GLUPprimitive primitive);
1294 
1299  virtual void end();
1300 
1312  virtual void draw_arrays(
1313  GLUPprimitive primitive, GLUPint first, GLUPsizei count
1314  );
1315 
1329  virtual void draw_elements(
1330  GLUPprimitive primitive, GLUPsizei count,
1331  GLUPenum type, const GLUPvoid* indices
1332  );
1333 
1342  virtual Memory::pointer get_state_variable_address(const char* name);
1343 
1349  return uniform_state_;
1350  }
1351 
1356  const UniformState& uniform_state() const {
1357  return uniform_state_;
1358  }
1359 
1366  uniform_buffer_dirty_ = true;
1367  }
1368 
1369 
1375  uniform_buffer_dirty_ = true;
1376  lighting_dirty_ = true;
1377  }
1378 
1384  uniform_buffer_dirty_ = true;
1385  matrices_dirty_ = true;
1386  }
1387 
1394  GLUPdouble* get_matrix(GLUPmatrix matrix) {
1395  geo_debug_assert(matrix < 3);
1396  return matrix_stack_[matrix].top();
1397  }
1398 
1406  std::vector<GLSL::Source>& sources
1407  );
1408 
1416  std::vector<GLSL::Source>& sources
1417  );
1418 
1426  std::vector<GLSL::Source>& sources
1427  );
1428 
1436  std::vector<GLSL::Source>& sources
1437  );
1438 
1446  std::vector<GLSL::Source>& sources
1447  );
1448 
1449 
1460  std::vector<GLSL::Source>& sources
1461  );
1462 
1472  std::vector<GLSL::Source>& sources
1473  );
1474 
1484  std::vector<GLSL::Source>& sources
1485  );
1486 
1497  GLUPbitfield toggles_state,
1498  GLUPbitfield toggles_undetermined=0
1499  );
1500 
1509  GLUPprimitive primitive
1510  );
1511 
1517  return immediate_state_;
1518  }
1519 
1523  virtual void flush_immediate_buffers();
1524 
1525 
1531  static const char* glup_primitive_name(GLUPprimitive prim);
1532 
1533 
1534  protected:
1535 
1544 
1554  bool extension_is_supported(const std::string& extension);
1555 
1566  virtual void prepare_to_draw(GLUPprimitive primitive);
1567 
1568 
1576  virtual void done_draw(GLUPprimitive primitive);
1577 
1581  virtual void setup_state_variables();
1582 
1583 
1588  virtual void setup_immediate_buffers();
1589 
1595 
1599  virtual void setup_primitives();
1600 
1604  virtual void setup_GLUP_POINTS();
1605 
1609  virtual void setup_GLUP_LINES();
1610 
1614  virtual void setup_GLUP_THICK_LINES();
1615 
1619  virtual void setup_GLUP_TRIANGLES();
1620 
1624  virtual void setup_GLUP_QUADS();
1625 
1629  virtual void setup_GLUP_TETRAHEDRA();
1630 
1634  virtual void setup_GLUP_HEXAHEDRA();
1635 
1639  virtual void setup_GLUP_PRISMS();
1640 
1644  virtual void setup_GLUP_PYRAMIDS();
1645 
1649  virtual void setup_GLUP_CONNECTORS();
1650 
1654  virtual void setup_GLUP_SPHERES();
1655 
1665  virtual void set_primitive_info(
1666  GLUPprimitive glup_primitive, GLenum gl_primitive, GLuint program,
1667  bool bind_attrib_loc_and_link = true
1668  );
1669 
1685  GLUPprimitive glup_primitive, GLenum gl_primitive, GLuint program
1686  );
1687 
1709  GLUPprimitive glup_primitive, GLenum gl_primitive, GLuint program,
1710  index_t nb_elements_per_glup_primitive,
1711  index_t* element_indices
1712  );
1713 
1719  if(uniform_buffer_dirty_) {
1720  do_update_uniform_buffer();
1721  }
1722  }
1723 
1730 
1735  virtual void update_matrices();
1736 
1742  virtual void update_lighting();
1743 
1748  virtual void update_base_picking_id(GLint new_value);
1749 
1755  std::string primitive_declaration(GLUPprimitive prim) const;
1756 
1765  PrimitiveInfo::ShaderKey toggles_config
1766  ) {
1767  if(toggles_config == (1 << GLUP_PICKING)) {
1768  setup_shaders_source_for_toggles(
1769  (1 << GLUP_PICKING), // picking=true
1770  (1 << GLUP_CLIPPING) // clipping=undecided (use state)
1771  );
1772  } else {
1773  setup_shaders_source_for_toggles(GLUPbitfield(toggles_config));
1774  }
1775  }
1776 
1782 
1790 
1802 
1810 
1816 
1824 
1835  bool cell_is_clipped(index_t first_v);
1836 
1837 
1848  index_t result = 0;
1849  for(index_t lv=0; lv<nb_v; ++lv) {
1850  if(v_is_visible_[first_v+lv]) {
1851  result = result | (1u << lv);
1852  }
1853  }
1854  return result;
1855  }
1856 
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);
1871 
1872  GLUPfloat t = -eqn[3] -(
1873  eqn[0]*p1[0] +
1874  eqn[1]*p1[1] +
1875  eqn[2]*p1[2]
1876  );
1877 
1878  GLUPfloat d =
1879  eqn[0]*(p2[0]-p1[0]) +
1880  eqn[1]*(p2[1]-p1[1]) +
1881  eqn[2]*(p2[2]-p1[2]) ;
1882 
1883  if(fabs(double(d)) < 1e-6) {
1884  t = 0.5f;
1885  } else {
1886  t /= d;
1887  }
1888 
1889  GLUPfloat s = 1.0f - t;
1890 
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;
1895 
1896  for(index_t i=1; i<3; ++i) {
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];
1906  }
1907  }
1908  }
1909 
1916 
1925  void use_program(GLuint program) {
1926  if(program != 0 && program != latest_program_) {
1927  glUseProgram(program);
1928  latest_program_ = program;
1929  copy_uniform_state_to_current_program();
1930  } else {
1931  glUseProgram(program);
1932  }
1933  }
1934 
1942 
1943  static void initialize();
1944 
1945  protected:
1946 
1947  // OpenGL Uniform state.
1948  GLuint default_program_;
1949  GLuint uniform_buffer_;
1950  GLuint uniform_binding_point_;
1951  GLint uniform_buffer_size_;
1952  bool uniform_buffer_dirty_;
1953 
1954  // C++ Uniform state.
1955  Memory::byte* uniform_buffer_data_;
1956  UniformState uniform_state_;
1957 
1958  bool lighting_dirty_;
1959 
1960  // Matrix stacks.
1961  GLUPmatrix matrix_mode_;
1962  MatrixStack matrix_stack_[3];
1963  bool matrices_dirty_;
1964 
1973  index_t nb_vertices_per_primitive_[GLUP_NB_PRIMITIVES];
1974 
1975  // Immediate mode buffers.
1976  ImmediateState immediate_state_;
1977 
1978  // Primitive informations (i.e., how to
1979  // draw a primitive of a given type).
1980  vector<PrimitiveInfo> primitive_info_;
1981 
1982  // The marching cells, for computing
1983  // intersections when clipping mode
1984  // is GLUP_CLIP_SLICE_CELLS
1985  MarchingCell marching_tet_;
1986  MarchingCell marching_hex_;
1987  MarchingCell marching_prism_;
1988  MarchingCell marching_pyramid_;
1989  MarchingCell marching_connector_;
1990 
1991  GLuint user_program_;
1992 
1993  PrimitiveInfo::ShaderKey toggles_config_;
1994 
1995  GLUPprimitive primitive_source_;
1996  GLUPbitfield toggles_source_state_;
1997  GLUPbitfield toggles_source_undetermined_;
1998 
1999  bool precompile_shaders_;
2000 
2001  bool use_core_profile_;
2002  bool use_ES_profile_;
2003 
2009  GLUPfloat* world_clip_plane_;
2010 
2016  std::map<std::string, GLsizei> variable_to_offset_;
2017 
2023  bool v_is_visible_[IMMEDIATE_BUFFER_SIZE];
2024 
2030  GLUPfloat isect_vertex_attribute_[3][12*4];
2031 
2038 
2044  };
2045 
2046  /*********************************************************************/
2047 }
2048 
2049 #endif
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.
Definition: GLUP.h:470
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.
Definition: GLUP_context.h:347
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.
Definition: GLUP_context.h:259
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.
Definition: GLUP_context.h:216
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.
Definition: assert.h:149
#define geo_debug_assert(x)
Verifies that a condition is met.
Definition: assert.h:196
A class that can register functions to the GLSL pseudo file system.
Definition: GLSL.h:175
Vector with aligned memory allocation.
Definition: memory.h:635
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...
Definition: GLUP_context.h:843
const GLUPfloat * get_pointer() const
Gets a pointer to the variable.
Definition: GLUP_context.h:868
FloatsArrayStateVariable()
FloatsArrayStateVariable default constructor.
Definition: GLUP_context.h:849
FloatsArrayStateVariable(Context *context, const char *name)
FloatsArrayStateVariable constructor.
Definition: GLUP_context.h:858
GLUPfloat * get_pointer()
Gets a modifiable pointer to the variable.
Definition: GLUP_context.h:879
A buffer used by GLUP in immediate mode.
Definition: GLUP_context.h:358
bool is_enabled() const
Tests whether this ImmediateBuffer is enabled.
Definition: GLUP_context.h:408
GLfloat * data()
Gets a pointer to the data.
Definition: GLUP_context.h:500
void set_current(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
Sets the current attribute value.
Definition: GLUP_context.h:418
size_t size_in_bytes() const
Gets the size of the memory used by the buffer.
Definition: GLUP_context.h:480
void enable()
Enables this ImmediateBuffer.
Definition: GLUP_context.h:392
index_t dimension() const
Gets the dimension of the attribute.
Definition: GLUP_context.h:472
ImmediateBuffer(const ImmediateBuffer &rhs)
ImmediateBuffer copy constructor.
Definition: GLUP_context.h:519
void copy(index_t to, ImmediateBuffer &from_buffer, index_t from)
Copies this attribute from another attribute.
Definition: GLUP_context.h:459
void copy(index_t to, index_t from)
Copies this attribute from a vertex to another one.
Definition: GLUP_context.h:444
void copy_current_to(index_t v)
Copies the current attribute value to a specified vertex in this buffer.
Definition: GLUP_context.h:431
GLfloat * element_ptr(index_t v)
Gets a pointer to one attribute value by index.
Definition: GLUP_context.h:490
void disable()
Disables this ImmediateBuffer.
Definition: GLUP_context.h:399
GLuint & VBO()
Gets the Vertex Buffer Object.
Definition: GLUP_context.h:509
Stores all the buffers used to implement the immediate-mode interface.
Definition: GLUP_context.h:545
GLuint & VAO()
Gets the Vertex Array Object.
Definition: GLUP_context.h:584
void begin(GLUPprimitive primitive, index_t max_current_vertex=0)
Configures the immediate state for rendering primitives of a given type.
Definition: GLUP_context.h:612
GLUPprimitive primitive() const
Gets the primitive currently rendered, i.e. the argument to the latest invocation of begin()
Definition: GLUP_context.h:661
void set_current_vertex(index_t v)
Sets the current vertex.
Definition: GLUP_context.h:697
void copy_element(index_t to, index_t from)
Copies an element, i.e. all the attributes attached to a vertex.
Definition: GLUP_context.h:595
void reset(index_t new_current_vertex=0)
Resets the current vertex index.
Definition: GLUP_context.h:653
ImmediateState(index_t *nb_vertices_per_primitive)
ImmediateState constructor.
Definition: GLUP_context.h:553
index_t nb_primitives() const
Gets the number of primitives stored in the buffers.
Definition: GLUP_context.h:675
index_t max_current_vertex() const
Gets the maximum number of vertices in the buffer before the buffer is flushed.
Definition: GLUP_context.h:687
index_t nb_vertices() const
Gets the number of vertices stored in the buffers.
Definition: GLUP_context.h:668
~ImmediateState()
ImmediateState destructor.
Definition: GLUP_context.h:572
void next_vertex()
Advances to the next vertex.
Definition: GLUP_context.h:631
bool buffers_are_full()
Tests whether the buffers are full.
Definition: GLUP_context.h:644
Implements the MarchingCells algorithm.
A Matrix stack.
Definition: GLUP_context.h:276
void push()
Pushes a copy of the top matrix.
Definition: GLUP_context.h:304
MatrixStack()
MatrixStack constructor.
Definition: GLUP_context.h:287
void pop()
Removes a matrix from the top of the stack.
Definition: GLUP_context.h:316
GLdouble * top()
Gets the matrix on the top of the stack.
Definition: GLUP_context.h:297
Base class for representing GLUP state variables.
Definition: GLUP_context.h:719
void flag_uniform_buffer_as_dirty()
Indicates that the variables in the context need to be sent to OpenGL.
StateVariableBase()
StateVariableBase default constructor.
Definition: GLUP_context.h:725
Memory::pointer address() const
Gets the address of the StateVariableBase.
Definition: GLUP_context.h:766
StateVariableBase(Context *context, const char *name)
StateVariableBase constructor.
Definition: GLUP_context.h:734
const std::string & name() const
Gets the name of this StateVariableBase.
Definition: GLUP_context.h:754
void initialize(Context *context, const char *name)
Initializes a StateVariableBase.
A GLUP state variable of a given type.
Definition: GLUP_context.h:785
void initialize(Context *context, const char *name, T value)
Initializes a StateVariable.
Definition: GLUP_context.h:814
StateVariable(Context *context, const char *name, T value)
StateVariableBase constructor.
Definition: GLUP_context.h:801
void set(T val)
Sets the value.
Definition: GLUP_context.h:832
T get() const
Gets the value.
Definition: GLUP_context.h:823
StateVariable()
StateVariable default constructor.
Definition: GLUP_context.h:791
A GLUP state variable that contains a vector.
Definition: GLUP_context.h:892
VectorStateVariable(Context *context, const char *name, index_t dimension)
VectorStateVariable constructor.
Definition: GLUP_context.h:908
void get(GLUPfloat *x) const
Gets the value.
Definition: GLUP_context.h:940
index_t dimension() const
Gets the dimension.
Definition: GLUP_context.h:931
void set(const GLUPfloat *x)
Sets the value.
Definition: GLUP_context.h:949
VectorStateVariable()
VectorStateVariable default constructor.
Definition: GLUP_context.h:898
void initialize(Context *context, const char *name, index_t dimension)
Initializes a VectorStateVariable.
Definition: GLUP_context.h:921
void clear()
clears the vector to its default value.
Definition: GLUP_context.h:960
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.
Definition: memory.h:92
byte * pointer
Pointer to unsigned byte(s)
Definition: memory.h:104
void clear(void *addr, size_t size)
Clears a memory block.
Definition: memory.h:116
void copy(void *to, const void *from, size_t size)
Copies a memory block.
Definition: memory.h:129
uint64_t uint64
Definition: numeric.h:144
Global Vorpaline namespace.
Definition: basic.h:55
geo_index_t index_t
The type for storing and manipulating indices.
Definition: numeric.h:329
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.
The set of state variables that represent GLUP uniform state.
Definition: GLUP_context.h:976