21 #ifndef Tulip_GLVERTEXARRAYMANAGER_H
22 #define Tulip_GLVERTEXARRAYMANAGER_H
28 #if defined(__APPLE__)
29 #include <OpenGL/gl.h>
30 #include <OpenGL/glu.h>
36 #include <tulip/Coord.h>
37 #include <tulip/Color.h>
38 #include <tulip/Observable.h>
39 #include <tulip/tuliphash.h>
48 class GlGraphInputData;
49 class PropertyInterface;
53 class IntegerProperty;
60 class TLP_GL_SCOPE GlVertexArrayManager :
private Observable {
68 GlVertexArrayManager(GlGraphInputData *inputData);
70 ~GlVertexArrayManager();
75 void setInputData(GlGraphInputData *inputData);
80 inline bool renderingIsBegin() {
92 void setHaveToComputeAll(
bool compute);
96 void setHaveToComputeLayout(
bool compute);
100 void setHaveToComputeColor(
bool compute);
106 void beginRendering();
116 void addEdge(GlEdge *edge);
120 void addNode(GlNode *node);
126 void pauseRendering(
bool pause);
131 void activate(
bool act);
140 void activateLineEdgeDisplay(GlEdge *edge,
bool selected);
144 void activateQuadEdgeDisplay(GlEdge *edge,
bool selected);
148 void activatePointEdgeDisplay(GlEdge *edge,
bool selected);
152 void activatePointNodeDisplay(GlNode *node,
bool selected);
157 void treatEvent(
const Event&);
159 void clearLayoutData();
160 void clearColorData();
162 void initObservers();
163 void clearObservers(PropertyInterface *deletedProperty=NULL);
165 GlGraphInputData *inputData;
168 LayoutProperty* layoutProperty;
169 SizeProperty* sizeProperty;
170 IntegerProperty* shapeProperty;
171 DoubleProperty* rotationProperty;
172 ColorProperty* colorProperty;
173 ColorProperty* borderColorProperty;
174 DoubleProperty* borderWidthProperty;
175 IntegerProperty *srcAnchorShapeProperty;
176 IntegerProperty *tgtAnchorShapeProperty;
177 SizeProperty *srcAnchorSizeProperty;
178 SizeProperty *tgtAnchorSizeProperty;
179 bool graphObserverActivated;
180 bool layoutObserverActivated;
181 bool colorObserverActivated;
186 bool toComputeLayout;
189 bool vectorLayoutSizeInit;
190 bool vectorColorSizeInit;
191 bool vectorIndexSizeInit;
194 bool colorInterpolate;
195 bool sizeInterpolate;
199 std::vector<Coord> linesCoordsArray;
200 std::vector<Color> linesColorsArray;
201 std::vector<GLint> linesIndexArray;
202 std::vector<GLsizei> linesIndexCountArray;
204 std::vector<GLuint> linesRenderingIndicesArray;
205 std::vector<GLuint> linesSelectedRenderingIndicesArray;
207 std::vector<Coord> quadsCoordsArray;
208 std::vector<Color> quadsColorsArray;
209 std::vector<Color> quadsOutlineColorsArray;
210 std::vector<GLuint> quadsIndexArray;
211 std::vector<GLsizei> quadsIndexCountArray;
212 std::vector<std::vector<GLuint> > quadsBottomOutlineIndexArray;
213 std::vector<std::vector<GLuint> > quadsTopOutlineIndexArray;
215 std::vector<GLuint> quadsRenderingIndicesArray;
216 std::vector<GLuint> quadsSelectedRenderingIndicesArray;
218 std::map<float, std::vector<GLuint> > quadsOutlineRenderingIndicesArray;
219 std::map<float, std::vector<GLuint> > quadsSelectedOutlineRenderingIndicesArray;
221 std::vector<Coord> pointsCoordsArray;
222 std::vector<Color> pointsColorsArray;
224 std::vector<GLuint> pointsNodesRenderingIndexArray;
225 std::vector<GLuint> pointsNodesSelectedRenderingIndexArray;
226 std::vector<GLuint> pointsEdgesRenderingIndexArray;
227 std::vector<GLuint> pointsEdgesSelectedRenderingIndexArray;
229 TLP_HASH_MAP<unsigned int, std::pair<unsigned int,unsigned int> > edgeToLineIndexVector;
230 TLP_HASH_MAP<unsigned int, std::pair<unsigned int,unsigned int> > edgeToQuadIndexVector;
231 TLP_HASH_MAP<unsigned int, unsigned int> edgeToBottomOulineIndexVector;
232 TLP_HASH_MAP<unsigned int, unsigned int> edgeToTopOutlineIndexVector;
233 TLP_HASH_MAP<unsigned int, unsigned int> edgeToPointIndexVector;
234 TLP_HASH_MAP<unsigned int, unsigned int> nodeToPointIndexVector;
236 GLuint pointsVerticesVBO;
237 GLuint pointsColorsVBO;
238 GLuint linesVerticesVBO;
239 GLuint linesColorsVBO;
240 GLuint quadsVerticesVBO;
241 GLuint quadsColorsVBO;
242 GLuint quadsOutlineColorsVBO;
244 bool pointsVerticesUploaded;
245 bool pointsColorsUploaded;
246 bool linesVerticesUploaded;
247 bool linesColorsUploaded;
248 bool quadsVerticesUploaded;
249 bool quadsColorsUploaded;
250 bool quadsOutlineColorsUploaded;
252 bool verticesUploadNeeded;
253 bool colorsUploadNeeded;
PropertyInterface describes the interface of a graph property.