21 #ifndef Tulip_GLVERTEXARRAYMANAGER_H 22 #define Tulip_GLVERTEXARRAYMANAGER_H 28 #if defined(__APPLE__) 29 #include <OpenGL/gl.h> 34 #include <tulip/Coord.h> 35 #include <tulip/Color.h> 36 #include <tulip/Observable.h> 37 #include <tulip/tuliphash.h> 46 class GlGraphInputData;
47 class PropertyInterface;
51 class IntegerProperty;
58 class TLP_GL_SCOPE GlVertexArrayManager :
private Observable {
66 GlVertexArrayManager(GlGraphInputData *inputData);
68 ~GlVertexArrayManager();
73 void setInputData(GlGraphInputData *inputData);
78 inline bool renderingIsBegin() {
90 void setHaveToComputeAll(
bool compute);
94 void setHaveToComputeLayout(
bool compute);
98 void setHaveToComputeColor(
bool compute);
104 void beginRendering();
114 void addEdge(GlEdge *edge);
118 void addNode(GlNode *node);
124 void pauseRendering(
bool pause);
129 void activate(
bool act);
138 void activateLineEdgeDisplay(GlEdge *edge,
bool selected);
142 void activateQuadEdgeDisplay(GlEdge *edge,
bool selected);
146 void activatePointEdgeDisplay(GlEdge *edge,
bool selected);
150 void activatePointNodeDisplay(GlNode *node,
bool selected);
155 void treatEvent(
const Event&);
157 void clearLayoutData();
158 void clearColorData();
160 void initObservers();
161 void clearObservers(PropertyInterface *deletedProperty=NULL);
163 GlGraphInputData *inputData;
166 LayoutProperty* layoutProperty;
167 SizeProperty* sizeProperty;
168 IntegerProperty* shapeProperty;
169 DoubleProperty* rotationProperty;
170 ColorProperty* colorProperty;
171 ColorProperty* borderColorProperty;
172 DoubleProperty* borderWidthProperty;
173 IntegerProperty *srcAnchorShapeProperty;
174 IntegerProperty *tgtAnchorShapeProperty;
175 SizeProperty *srcAnchorSizeProperty;
176 SizeProperty *tgtAnchorSizeProperty;
177 bool graphObserverActivated;
178 bool layoutObserverActivated;
179 bool colorObserverActivated;
184 bool toComputeLayout;
187 bool vectorLayoutSizeInit;
188 bool vectorColorSizeInit;
189 bool vectorIndexSizeInit;
192 bool colorInterpolate;
193 bool sizeInterpolate;
197 std::vector<Coord> linesCoordsArray;
198 std::vector<Color> linesColorsArray;
199 std::vector<GLint> linesIndexArray;
200 std::vector<GLsizei> linesIndexCountArray;
202 std::vector<GLuint> linesRenderingIndicesArray;
203 std::vector<GLuint> linesSelectedRenderingIndicesArray;
205 std::vector<Coord> quadsCoordsArray;
206 std::vector<Color> quadsColorsArray;
207 std::vector<Color> quadsOutlineColorsArray;
208 std::vector<GLuint> quadsIndexArray;
209 std::vector<GLsizei> quadsIndexCountArray;
210 std::vector<std::vector<GLuint> > quadsBottomOutlineIndexArray;
211 std::vector<std::vector<GLuint> > quadsTopOutlineIndexArray;
213 std::vector<GLuint> quadsRenderingIndicesArray;
214 std::vector<GLuint> quadsSelectedRenderingIndicesArray;
216 std::map<float, std::vector<GLuint> > quadsOutlineRenderingIndicesArray;
217 std::map<float, std::vector<GLuint> > quadsSelectedOutlineRenderingIndicesArray;
219 std::vector<Coord> pointsCoordsArray;
220 std::vector<Color> pointsColorsArray;
222 std::vector<GLuint> pointsNodesRenderingIndexArray;
223 std::vector<GLuint> pointsNodesSelectedRenderingIndexArray;
224 std::vector<GLuint> pointsEdgesRenderingIndexArray;
225 std::vector<GLuint> pointsEdgesSelectedRenderingIndexArray;
227 TLP_HASH_MAP<unsigned int, std::pair<unsigned int,unsigned int> > edgeToLineIndexVector;
228 TLP_HASH_MAP<unsigned int, std::pair<unsigned int,unsigned int> > edgeToQuadIndexVector;
229 TLP_HASH_MAP<unsigned int, unsigned int> edgeToBottomOulineIndexVector;
230 TLP_HASH_MAP<unsigned int, unsigned int> edgeToTopOutlineIndexVector;
231 TLP_HASH_MAP<unsigned int, unsigned int> edgeToPointIndexVector;
232 TLP_HASH_MAP<unsigned int, unsigned int> nodeToPointIndexVector;
234 GLuint pointsVerticesVBO;
235 GLuint pointsColorsVBO;
236 GLuint linesVerticesVBO;
237 GLuint linesColorsVBO;
238 GLuint quadsVerticesVBO;
239 GLuint quadsColorsVBO;
240 GLuint quadsOutlineColorsVBO;
242 bool pointsVerticesUploaded;
243 bool pointsColorsUploaded;
244 bool linesVerticesUploaded;
245 bool linesColorsUploaded;
246 bool quadsVerticesUploaded;
247 bool quadsColorsUploaded;
248 bool quadsOutlineColorsUploaded;
250 bool verticesUploadNeeded;
251 bool colorsUploadNeeded;
PropertyInterface describes the interface of a graph property.