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