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