Tulip  5.1.0
Large graphs analysis and drawing
GlGraphLowDetailsRenderer.h
1 /*
2  *
3  * This file is part of Tulip (http://tulip.labri.fr)
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 #include <tulip/OpenGlIncludes.h>
25 
26 #include <vector>
27 
28 #include <tulip/Observable.h>
29 #include <tulip/GlGraphRenderer.h>
30 
31 namespace tlp {
32 
33 class Graph;
34 class GlScene;
35 class LayoutProperty;
36 class ColorProperty;
37 class SizeProperty;
38 class BooleanProperty;
39 
40 /** \brief Class to display graph with very simple and very fast renderer
41  *
42  * Very high performance renderer
43  * This class display graph with :
44  * - Nodes : quads
45  * - Edges : lines
46  * Warning : this renderer doesn't work for selection
47  *
48  * See GlGraphRenderer documentation for functions documentations
49  */
50 class TLP_GL_SCOPE GlGraphLowDetailsRenderer : public GlGraphRenderer, public Observable {
51 
52 public:
53 
54  GlGraphLowDetailsRenderer(const GlGraphInputData *inputData);
55 
56  ~GlGraphLowDetailsRenderer();
57 
58  virtual void draw(float lod,Camera* camera);
59 
60  void initSelectionRendering(RenderingEntitiesFlag ,std::map<unsigned int, SelectedEntity> &,unsigned int &) {
61  assert (false);
62  }
63 
64 protected:
65 
66  void initEdgesArray();
67  void initTexArray(unsigned int glyph, Vec2f tex[4]);
68  void initNodesArray();
69 
70  void addObservers();
71  void removeObservers();
72  void updateObservers();
73  void treatEvent(const Event &ev);
74 
75  GlScene *fakeScene;
76 
77  bool buildVBO;
78 
79  std::vector<Vec2f> points;
80  std::vector<Color> colors;
81  std::vector<GLuint> indices;
82 
83  std::vector<Vec2f> quad_points;
84  std::vector<Color> quad_colors;
85  std::vector<GLuint> quad_indices;
86 
87  Graph *observedGraph;
88  LayoutProperty *observedLayoutProperty;
89  ColorProperty *observedColorProperty;
90  SizeProperty *observedSizeProperty;
91  BooleanProperty *observedSelectionProperty;
92 };
93 }
94 
95 #endif
96 ///@endcond