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