Salome HOME
a1fbe111838c184e3a245c678b833492d9592670
[modules/gui.git] / src / VTKViewer / VTKViewer_OpenGLRenderer.h
1 // Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #ifndef VTKVIEWER_OPENGLRENDERER_H
24 #define VTKVIEWER_OPENGLRENDERER_H
25
26 #include "VTKViewer.h"
27 #include "vtkOpenGLRenderer.h"
28 #include "VTKViewer_OpenGLHelper.h"
29
30 class VTKVIEWER_EXPORT VTKViewer_OpenGLRenderer : public vtkOpenGLRenderer
31 {
32 public:
33   enum {
34     HorizontalGradient,
35     VerticalGradient,
36     FirstDiagonalGradient,
37     SecondDiagonalGradient,
38     FirstCornerGradient,
39     SecondCornerGradient,
40     ThirdCornerGradient,
41     FourthCornerGradient
42   };
43
44 public:
45   static VTKViewer_OpenGLRenderer *New();
46   vtkTypeMacro(VTKViewer_OpenGLRenderer,vtkOpenGLRenderer)
47
48   virtual void SetGradientType( const int );
49
50   virtual void Clear(void);
51
52 protected:
53   VTKViewer_OpenGLRenderer();
54   ~VTKViewer_OpenGLRenderer();
55
56 private:
57   int GradientType;
58
59   typedef std::vector< std::vector<double> > Vec2D;
60   void GetCornersColor(Vec2D&);
61
62 #ifdef VTK_OPENGL2
63   VTKViewer_OpenGLHelper OpenGLHelper;
64   GLhandleARB            BackgroundProgram;
65   GLhandleARB            BackgroundVertexShader;
66   GLhandleARB            BackgroundFragmentShader;
67   GLuint                 VertexArrayObject;
68
69   struct Locations
70   {
71     static const GLint INVALID_LOCATION = -1;
72
73     GLint UseTexture;
74     GLint BackgroundTexture;
75
76     Locations()
77     : UseTexture        (INVALID_LOCATION),
78       BackgroundTexture (INVALID_LOCATION)
79     {
80       //
81     }
82
83   } myLocations;
84 #endif
85
86
87 private:
88   VTKViewer_OpenGLRenderer(const VTKViewer_OpenGLRenderer&);  // Not implemented.
89   void operator=(const VTKViewer_OpenGLRenderer&);  // Not implemented.
90 };
91
92 #endif