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