]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/Visualization/OpenGLMeshMapper.h
...
[cpPlugins.git] / lib / cpExtensions / Visualization / OpenGLMeshMapper.h
1 #ifndef __CPEXTENSIONS__VISUALIZATION__OPENGLMESHMAPPER__H__
2 #define __CPEXTENSIONS__VISUALIZATION__OPENGLMESHMAPPER__H__
3
4 #include <vector>
5
6 #include <cpExtensions/Visualization/MeshMapper.h>
7
8 namespace cpExtensions
9   {
10     namespace Visualization
11     {
12       /**
13        */
14       template< class M >
15       class OpenGLMeshMapper
16         : public MeshMapper< M >
17       {
18       public:
19         typedef OpenGLMeshMapper Self;
20         vtkTypeMacro( OpenGLMeshMapper, MeshMapper< M > );
21
22         typedef typename Superclass::TMesh   TMesh;
23         typedef typename Superclass::TPoint  TPoint;
24         typedef typename Superclass::TVector TVector;
25         typedef typename Superclass::TScalar TScalar;
26
27       protected:
28         typedef unsigned int                            TIndex;
29         typedef typename M::CellType                    TCell;
30         typedef typename M::CellsContainer              TCellsContainer;
31         typedef typename TCellsContainer::ConstIterator TCellIt;
32
33       public:
34         virtual const char* GetNameOfClass( ) const
35           { return( "cpExtensions::OpenGLMeshMapper" ); }
36         static Self* New( );
37
38         virtual void RenderPiece( vtkRenderer* aren, vtkActor* act );
39         virtual void ReleaseGraphicsResources( vtkWindow* win );
40         virtual int Draw( vtkRenderer* aren, vtkActor* act );
41
42       protected:
43         OpenGLMeshMapper( );
44         virtual ~OpenGLMeshMapper( );
45
46         bool _ConfigureOpenGL( );
47
48       private:
49         // Purposely not implemented
50         OpenGLMeshMapper( const Self& other );
51         Self& operator=( const Self& other );
52
53       protected:
54         vtkIdType TotalCells;
55         // TODO: vtkSmartPointer< vtkOpenGLTexture > InternalColorTexture;
56
57         bool FirstRendering;
58
59         bool VBOSupported;
60         unsigned int VBOID1, VBOID2;
61
62         std::vector< unsigned int > Sizes;
63         std::vector< TIndex > Indices;
64         long IndexElementType;
65         long ElementValueType;
66       };
67
68     } // ecapseman
69
70   } // ecapseman
71
72 #include <cpExtensions/Visualization/OpenGLMeshMapper.hxx>
73
74 #endif // __CPEXTENSIONS__VISUALIZATION__OPENGLMESHMAPPER__H__
75
76 // eof - $RCSfile$