Tulip  4.6.1
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
GlFeedBackRecorder.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
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_GLFEEDBACKRECORDER_H
22 #define Tulip_GLFEEDBACKRECORDER_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 #endif
35 
36 #include <tulip/tulipconf.h>
37 #include <tulip/Vector.h>
38 
39 namespace tlp {
40 
41 class GlFeedBackBuilder;
42 
43 /** \brief Class use to build an object with an OpenGL feedback buffer
44  *
45  * Class use to build an object with an OpenGL feedback buffer
46  * This class call functions of the GlFeedBackBuilder passed to the constructor
47  */
48 class TLP_GL_SCOPE GlFeedBackRecorder {
49 
50 public:
51 
52  /**
53  * Constructor : the recorder use GlFeedBackBuilder : builder
54  */
55  GlFeedBackRecorder(GlFeedBackBuilder *builder,unsigned int pointSize=7);
56  /**
57  * Record a new feedback buffer
58  * \param doSort : sort the feedback buffer
59  * \param size : size of the feedback buffer
60  * \param feedBackBuffer : the feedback buffer
61  * \param viewport : the viewport of the scene
62  */
63  void record(bool doSort, GLint size, GLfloat *feedBackBuffer,const Vector<int,4>& viewport);
64 
65 private:
66 
67  void sortAndRecord(GLint size, GLfloat *feedBackBuffer);
68  void record(GLint size, GLfloat *feedBackBuffer);
69  GLfloat* recordPrimitive(GLfloat *loc);
70 
71  GlFeedBackBuilder *feedBackBuilder;
72  unsigned int pointSize;
73 
74 };
75 
76 }
77 
78 #endif // Tulip_GLFEEDBACKRECORDER_H
79 ///@endcond