Tulip  4.7.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
GlGraphLowDetailsRenderer.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 #ifndef Tulip_GLGRAPHLOWDETAILSRENDERER_H
22 #define Tulip_GLGRAPHLOWDETAILSRENDERER_H
23 
24 #if defined(_MSC_VER)
25 #include <Windows.h>
26 #endif
27 
28 #if defined(__APPLE__)
29 #include <OpenGL/gl.h>
30 #include <OpenGL/glu.h>
31 #else
32 #include <GL/gl.h>
33 #include <GL/glu.h>
34 #endif
35 
36 #include <vector>
37 
38 #include <tulip/Observable.h>
39 #include <tulip/GlGraphRenderer.h>
40 
41 namespace tlp {
42 
43 class Graph;
44 class GlScene;
45 class LayoutProperty;
46 class ColorProperty;
47 class SizeProperty;
48 class BooleanProperty;
49 
50 /** \brief Class to display graph with very simple and very fast renderer
51  *
52  * Very high performance renderer
53  * This class display graph with :
54  * - Nodes : quads
55  * - Edges : lines
56  * Warning : this renderer doesn't work for selection
57  *
58  * See GlGraphRenderer documentation for functions documentations
59  */
60 class TLP_GL_SCOPE GlGraphLowDetailsRenderer : public GlGraphRenderer, public Observable {
61 
62 public:
63 
64  GlGraphLowDetailsRenderer(const GlGraphInputData *inputData);
65 
66  ~GlGraphLowDetailsRenderer();
67 
68  virtual void draw(float lod,Camera* camera);
69 
70  void initSelectionRendering(RenderingEntitiesFlag ,std::map<unsigned int, SelectedEntity> &,unsigned int &) {
71  assert (false);
72  }
73 
74 protected:
75 
76  void initEdgesArray();
77  void initTexArray(unsigned int glyph, Vec2f tex[4]);
78  void initNodesArray();
79 
80  void addObservers();
81  void removeObservers();
82  void updateObservers();
83  void treatEvent(const Event &ev);
84 
85  GlScene *fakeScene;
86 
87  bool buildVBO;
88 
89  std::vector<Vec2f> points;
90  std::vector<Color> colors;
91  std::vector<GLuint> indices;
92 
93  std::vector<Vec2f> quad_points;
94  std::vector<Color> quad_colors;
95  std::vector<GLuint> quad_indices;
96 
97  Graph *observedGraph;
98  LayoutProperty *observedLayoutProperty;
99  ColorProperty *observedColorProperty;
100  SizeProperty *observedSizeProperty;
101  BooleanProperty *observedSelectionProperty;
102 };
103 }
104 
105 #endif
106 ///@endcond