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