Tulip  5.7.4
Large graphs analysis and drawing
GlGraphLowDetailsRenderer.h
1 /*
2  *
3  * This file is part of Tulip (https://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  GlGraphLowDetailsRenderer(const GlGraphInputData *inputData);
54 
55  ~GlGraphLowDetailsRenderer() override;
56 
57  void draw(float lod, Camera *camera) override;
58 
59 protected:
60  void initEdgesArray();
61  void initTexArray(unsigned int glyph, Vec2f tex[4]);
62  void initNodesArray();
63 
64  void addObservers();
65  void removeObservers();
66  void updateObservers();
67  void treatEvent(const Event &ev) override;
68 
69  GlScene *fakeScene;
70 
71  bool buildVBO;
72 
73  std::vector<Vec2f> points;
74  std::vector<Color> colors;
75  std::vector<GLuint> indices;
76 
77  std::vector<Vec2f> quad_points;
78  std::vector<Color> quad_colors;
79  std::vector<GLuint> quad_indices;
80 
81  Graph *observedGraph;
82  LayoutProperty *observedLayoutProperty;
83  ColorProperty *observedColorProperty;
84  SizeProperty *observedSizeProperty;
85  BooleanProperty *observedSelectionProperty;
86 };
87 } // namespace tlp
88 
89 #endif
90 ///@endcond