anatomist  5.1.2
3D neuroimaging data viewer
primitive.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 
35 #ifndef ANATOMIST_PRIMITIVE_PRIMITIVE_H
36 #define ANATOMIST_PRIMITIVE_PRIMITIVE_H
37 
39 #include <list>
40 
41 
42 namespace anatomist
43 {
44 
47  class GLItem : public carto::RCObject
48  {
49  public:
50  inline GLItem() : carto::RCObject(), _ghost( false ) {}
51  virtual ~GLItem();
52 
54  virtual void callList() const = 0;
57  virtual bool ghost() const;
58  virtual void setGhost( bool );
59 
60  private:
61  bool _ghost;
62  };
63 
64 
66  class Primitive : public GLItem
67  {
68  public:
71  virtual ~Primitive();
72 
73  const std::list<unsigned> & glLists() const;
74  const std::list<unsigned> & textures() const;
75  void insertList( unsigned );
76  void insertTexture( unsigned );
77  void deleteList( unsigned );
78  void deleteTexture( unsigned );
79  virtual void callList() const;
80 
81  void clear();
82 
83  protected:
84  std::list<unsigned> _gll;
85  std::list<unsigned> _tex;
86 
87  private:
88  };
89 
90 
91  // Single OpenGL display list
92  class GLList : public GLItem
93  {
94  public:
95  inline GLList( unsigned gllist = 0 ) : GLItem(), _item( gllist ) {}
97  virtual ~GLList();
98 
99  unsigned item() const { return _item; }
102  virtual void generate();
103  virtual void callList() const;
104 
105  private:
106  unsigned _item;
107  };
108 
109 
110  // Single OpenGL texture object
111  class GLTexture : public GLItem
112  {
113  public:
114  GLTexture( unsigned gltex = 0 ) : GLItem(), _item( gltex ) {}
116  virtual ~GLTexture();
117 
118  unsigned item() const { return _item; }
121  virtual void generate();
122  virtual void callList() const;
123 
124  private:
125  unsigned _item;
126  };
127 
128 
130 
131 
132  class GLItemList : public GLItem
133  {
134  public:
136  virtual ~GLItemList();
137  virtual void callList() const;
138 
139  std::list<RefGLItem> items;
140  };
141 
142 
144  {
145  public:
147  virtual ~GLNoExecItemList();
148  virtual void callList() const {}
149  };
150 
151 
156  typedef std::list<RefGLItem> GLPrimitives;
157 
158 }
159 
160 #endif
virtual void callList() const
renders the display list
std::list< RefGLItem > items
Definition: primitive.h:139
OpenGL item (display list, texture, ...) with reference counter and cleanup upon destruction.
Definition: primitive.h:48
virtual void setGhost(bool)
virtual void callList() const =0
renders the display list
virtual bool ghost() const
ghost lists are not selectable and not rendered in Z buffers for selection
virtual void callList() const
renders the display list
unsigned item() const
Definition: primitive.h:99
GLList(unsigned gllist=0)
Definition: primitive.h:95
virtual void generate()
generates a new display list.
virtual ~GLList()
GLList destructor makes the shatred context current.
virtual void callList() const
renders the display list
Definition: primitive.h:148
virtual ~GLTexture()
GLTexture destructor makes the shatred context current.
GLTexture(unsigned gltex=0)
Definition: primitive.h:114
virtual void callList() const
renders the display list
unsigned item() const
Definition: primitive.h:118
virtual void generate()
generates a new texture name.
Multiple display lists and texture objects.
Definition: primitive.h:67
const std::list< unsigned > & glLists() const
void deleteList(unsigned)
void insertList(unsigned)
void insertTexture(unsigned)
void deleteTexture(unsigned)
std::list< unsigned > _gll
Definition: primitive.h:84
virtual ~Primitive()
Primitive destructor makes the shatred context current.
const std::list< unsigned > & textures() const
std::list< unsigned > _tex
Definition: primitive.h:85
virtual void callList() const
renders the display list
carto::rc_ptr< Primitive > RefPrimitive
Definition: primitive.h:152
carto::rc_ptr< GLTexture > RefGLTexture
Definition: primitive.h:154
carto::rc_ptr< GLItem > RefGLItem
Definition: primitive.h:129
carto::rc_ptr< GLList > RefGLList
Definition: primitive.h:153
carto::rc_ptr< GLItemList > RefGLItemList
Definition: primitive.h:155
std::list< RefGLItem > GLPrimitives
Definition: primitive.h:156