VTK
vtkOpenGLRenderer.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOpenGLRenderer.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
26 #ifndef vtkOpenGLRenderer_h
27 #define vtkOpenGLRenderer_h
28 
29 #include "vtkRenderingOpenGLModule.h" // For export macro
30 #include "vtkRenderer.h"
31 
32 class vtkOpenGLRendererLayerList; // Pimpl
33 class vtkRenderPass;
34 class vtkShaderProgram2;
35 
36 class VTKRENDERINGOPENGL_EXPORT vtkOpenGLRenderer : public vtkRenderer
37 {
38 public:
39  static vtkOpenGLRenderer *New();
41  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
42 
46  void DeviceRender(void) VTK_OVERRIDE;
47 
51  void DeviceRenderOpaqueGeometry() VTK_OVERRIDE;
52 
59  void DeviceRenderTranslucentPolygonalGeometry() VTK_OVERRIDE;
60 
65  void ClearLights(void) VTK_OVERRIDE;
66 
67  void Clear(void) VTK_OVERRIDE;
68 
72  int UpdateLights(void) VTK_OVERRIDE;
73 
80  int GetDepthPeelingHigherLayer();
81 
83 
86  vtkGetObjectMacro(ShaderProgram, vtkShaderProgram2);
87  virtual void SetShaderProgram(vtkShaderProgram2 *program);
89 
90 protected:
92  ~vtkOpenGLRenderer() VTK_OVERRIDE;
93 
97  void CheckCompilation(unsigned int fragmentShader);
98 
99  // Internal method to release graphics resources in any derived renderers.
100  void ReleaseGraphicsResources(vtkWindow *w) VTK_OVERRIDE;
101 
102  // Picking functions to be implemented by sub-classes
103  void DevicePickRender() VTK_OVERRIDE;
104  void StartPick(unsigned int pickFromSize) VTK_OVERRIDE;
105  void UpdatePickId() VTK_OVERRIDE;
106  void DonePick() VTK_OVERRIDE;
107  unsigned int GetPickedId() VTK_OVERRIDE;
108  unsigned int GetNumPickedIds() VTK_OVERRIDE;
109  int GetPickedIds(unsigned int atMost, unsigned int *callerBuffer) VTK_OVERRIDE;
110  double GetPickedZ() VTK_OVERRIDE;
111 
112  // Ivars used in picking
113  class vtkGLPickInfo* PickInfo;
114 
115  double PickedZ;
116 
117  int NumberOfLightsBound;
124  int RenderPeel(int layer);
125 
126  friend class vtkOpenGLProperty;
127  friend class vtkOpenGLTexture;
129  friend class vtkOpenGLImageResliceMapper;
130 
135  int GetUseTextureUniformVariable();
136 
141  int GetTextureUniformVariable();
142 
147  int DepthPeelingIsSupported;
148 
153  int DepthPeelingIsSupportedChecked;
154 
158  vtkOpenGLRendererLayerList *LayerList;
159 
160  unsigned int OpaqueLayerZ;
161  unsigned int TransparentLayerZ;
162  unsigned int ProgramShader;
163 
165 
168  int ViewportX;
169  int ViewportY;
170  int ViewportWidth;
171  int ViewportHeight;
173 
178  unsigned int DepthFormat;
179 
180  // Is rendering at translucent geometry stage using depth peeling and
181  // rendering a layer other than the first one? (Boolean value)
182  // If so, the uniform variables UseTexture and Texture can be set.
183  // (Used by vtkOpenGLProperty or vtkOpenGLTexture)
184  int DepthPeelingHigherLayer;
185 
186  vtkShaderProgram2 *ShaderProgram;
187 
188  friend class vtkRenderPass;
189 
190 private:
191  vtkOpenGLRenderer(const vtkOpenGLRenderer&) VTK_DELETE_FUNCTION;
192  void operator=(const vtkOpenGLRenderer&) VTK_DELETE_FUNCTION;
193 };
194 
195 #endif
abstract specification for renderers
Definition: vtkRenderer.h:63
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
OpenGL property.
OpenGL mapper for image slice display.
OpenGL texture map.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
GLSL Program.
virtual void DeviceRender()=0
Create an image.
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual void DeviceRenderOpaqueGeometry()
Render opaque polygonal geometry.
static vtkRenderer * New()
Create a vtkRenderer with a black background, a white ambient light, two-sided lighting turned on...
Perform part of the rendering of a vtkRenderer.
Definition: vtkRenderPass.h:58
OpenGL renderer.