21 #ifndef Tulip_GLVERTEXARRAYMANAGER_H
22 #define Tulip_GLVERTEXARRAYMANAGER_H
28 #if defined(__APPLE__)
29 #include <OpenGL/gl.h>
30 #include <OpenGL/glu.h>
34 # if defined(__WIN32__)
35 # include <GL/glext.h>
39 #include <tulip/Coord.h>
40 #include <tulip/Color.h>
41 #include <tulip/Observable.h>
50 class GlGraphInputData;
51 class PropertyInterface;
55 class IntegerProperty;
62 class TLP_GL_SCOPE GlVertexArrayManager :
private Observable {
70 GlVertexArrayManager(GlGraphInputData *inputData);
72 ~GlVertexArrayManager();
77 void setInputData(GlGraphInputData *inputData);
82 inline bool renderingIsBegin() {
94 void setHaveToComputeAll(
bool compute);
98 void setHaveToComputeLayout(
bool compute);
102 void setHaveToComputeColor(
bool compute);
108 void beginRendering();
118 void addEdge(GlEdge *edge);
122 void addNode(GlNode *node);
128 void pauseRendering(
bool pause);
133 void activate(
bool act);
142 void activateLineEdgeDisplay(GlEdge *edge,
bool selected);
146 void activateQuadEdgeDisplay(GlEdge *edge,
bool selected);
150 void activatePointEdgeDisplay(GlEdge *edge,
bool selected);
154 void activatePointNodeDisplay(GlNode *node,
bool onePixel,
bool selected);
159 void treatEvent(
const Event&);
161 void clearLayoutData();
162 void clearColorData();
164 void initObservers();
165 void clearObservers(PropertyInterface *deletedProperty=NULL);
167 GlGraphInputData *inputData;
170 LayoutProperty* layoutProperty;
171 SizeProperty* sizeProperty;
172 IntegerProperty* shapeProperty;
173 DoubleProperty* rotationProperty;
174 ColorProperty* colorProperty;
175 ColorProperty* borderColorProperty;
176 DoubleProperty* borderWidthProperty;
177 IntegerProperty *srcAnchorShapeProperty;
178 IntegerProperty *tgtAnchorShapeProperty;
179 SizeProperty *srcAnchorSizeProperty;
180 SizeProperty *tgtAnchorSizeProperty;
181 bool graphObserverActivated;
182 bool layoutObserverActivated;
183 bool colorObserverActivated;
188 bool toComputeLayout;
191 bool vectorLayoutSizeInit;
192 bool vectorColorSizeInit;
193 bool vectorIndexSizeInit;
196 bool colorInterpolate;
197 bool sizeInterpolate;
201 std::vector<Coord> linesCoordsArray;
202 std::vector<Color> linesColorsArray;
203 std::vector<GLint> linesIndexArray;
204 std::vector<GLsizei> linesIndexCountArray;
206 std::vector<GLint> linesRenderingStartIndexArray;
207 std::vector<GLsizei> linesRenderingCountArray;
208 std::vector<GLint> linesSelectedRenderingStartIndexArray;
209 std::vector<GLsizei> linesSelectedRenderingCountArray;
211 std::vector<Coord> quadsCoordsArray;
212 std::vector<Color> quadsColorsArray;
213 std::vector<Color> quadsOutlineColorsArray;
214 std::vector<GLint> quadsIndexArray;
215 std::vector<GLsizei> quadsIndexCountArray;
216 std::vector<std::vector<GLuint> > quadsBottomOutlineIndexArray;
217 std::vector<std::vector<GLuint> > quadsTopOutlineIndexArray;
219 std::vector<GLint> quadsRenderingStartIndexArray;
220 std::vector<GLsizei> quadsRenderingCountArray;
221 std::vector<GLint> quadsSelectedRenderingStartIndexArray;
222 std::vector<GLsizei> quadsSelectedRenderingCountArray;
223 std::map<float, std::vector<const GLuint* > > quadsOutlineRenderingIndexArray;
224 std::map<float, std::vector<GLsizei> > quadsOutlineRenderingCountArray;
225 std::map<float, std::vector<const GLuint* > > quadsOutlineSelectedRenderingIndexArray;
226 std::map<float, std::vector<GLsizei> > quadsOutlineSelectedRenderingCountArray;
228 std::vector<Coord> pointsCoordsArray;
229 std::vector<Color> pointsColorsArray;
231 std::vector<GLuint> points1PNodesRenderingIndexArray;
232 std::vector<GLuint> points1PNodesSelectedRenderingIndexArray;
233 std::vector<GLuint> points2PNodesRenderingIndexArray;
234 std::vector<GLuint> points2PNodesSelectedRenderingIndexArray;
235 std::vector<GLuint> points1PEdgesRenderingIndexArray;
236 std::vector<GLuint> points1PEdgesSelectedRenderingIndexArray;
238 std::vector<std::pair<unsigned int,unsigned int> > edgeToLineIndexVector;
239 std::vector<std::pair<unsigned int,unsigned int> > edgeToQuadIndexVector;
240 std::vector<unsigned int> edgeToBottomOulineIndexVector;
241 std::vector<unsigned int> edgeToTopOutlineIndexVector;
242 std::vector<unsigned int> edgeToPointIndexVector;
243 std::vector<unsigned int> nodeToPointIndexVector;