Tulip  4.6.0
Better Visualization Through Research
library/tulip-ogl/include/tulip/GlGraphLowDetailsRenderer.h
00001 /*
00002  *
00003  * This file is part of Tulip (www.tulip-software.org)
00004  *
00005  * Authors: David Auber and the Tulip development Team
00006  * from LaBRI, University of Bordeaux
00007  *
00008  * Tulip is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU Lesser General Public License
00010  * as published by the Free Software Foundation, either version 3
00011  * of the License, or (at your option) any later version.
00012  *
00013  * Tulip is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  * See the GNU General Public License for more details.
00017  *
00018  */
00019 ///@cond DOXYGEN_HIDDEN
00020 
00021 #ifndef Tulip_GLGRAPHLOWDETAILSRENDERER_H
00022 #define Tulip_GLGRAPHLOWDETAILSRENDERER_H
00023 
00024 #if defined(_MSC_VER)
00025 #include <Windows.h>
00026 #endif
00027 
00028 #if defined(__APPLE__)
00029 #include <OpenGL/gl.h>
00030 #include <OpenGL/glu.h>
00031 #else
00032 #include <GL/gl.h>
00033 #include <GL/glu.h>
00034 #endif
00035 
00036 #include <vector>
00037 
00038 #include <tulip/Observable.h>
00039 #include <tulip/GlGraphRenderer.h>
00040 
00041 namespace tlp {
00042 
00043 class Graph;
00044 class GlScene;
00045 class LayoutProperty;
00046 class ColorProperty;
00047 class SizeProperty;
00048 class BooleanProperty;
00049 
00050 /** \brief Class to display graph with very simple and very fast renderer
00051  *
00052  * Very high performance renderer
00053  * This class display graph with :
00054  *  - Nodes : quads
00055  *  - Edges : lines
00056  * Warning : this renderer doesn't work for selection
00057  *
00058  * See GlGraphRenderer documentation for functions documentations
00059  */
00060 class TLP_GL_SCOPE GlGraphLowDetailsRenderer : public GlGraphRenderer, public Observable {
00061 
00062 public:
00063 
00064   GlGraphLowDetailsRenderer(const GlGraphInputData *inputData);
00065 
00066   ~GlGraphLowDetailsRenderer();
00067 
00068   virtual void draw(float lod,Camera* camera);
00069 
00070   void initSelectionRendering(RenderingEntitiesFlag ,std::map<unsigned int, SelectedEntity> &,unsigned int &) {
00071     assert (false);
00072   }
00073 
00074 protected:
00075 
00076   void initEdgesArray();
00077   void initTexArray(unsigned int glyph, Vec2f tex[4]);
00078   void initNodesArray();
00079 
00080   void addObservers();
00081   void removeObservers();
00082   void updateObservers();
00083   void treatEvent(const Event &ev);
00084 
00085   GlScene *fakeScene;
00086 
00087   bool buildVBO;
00088 
00089   std::vector<Vec2f>   points;
00090   std::vector<Color>   colors;
00091   std::vector<GLuint>  indices;
00092 
00093   std::vector<Vec2f>   quad_points;
00094   std::vector<Color>   quad_colors;
00095   std::vector<GLuint>  quad_indices;
00096 
00097   Graph *observedGraph;
00098   LayoutProperty *observedLayoutProperty;
00099   ColorProperty *observedColorProperty;
00100   SizeProperty *observedSizeProperty;
00101   BooleanProperty *observedSelectionProperty;
00102 };
00103 }
00104 
00105 #endif
00106 ///@endcond
 All Classes Files Functions Variables Enumerations Enumerator Properties