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 =========================================================================*/
23 #ifndef vtkOpenGLRenderer_h
24 #define vtkOpenGLRenderer_h
25 
26 #include "vtkRenderingOpenGLModule.h" // For export macro
27 #include "vtkRenderer.h"
28 
29 class vtkOpenGLRendererLayerList; // Pimpl
30 class vtkRenderPass;
31 class vtkShaderProgram2;
32 
33 class VTKRENDERINGOPENGL_EXPORT vtkOpenGLRenderer : public vtkRenderer
34 {
35 public:
36  static vtkOpenGLRenderer *New();
38  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
39 
43  void DeviceRender(void) VTK_OVERRIDE;
44 
48  void DeviceRenderOpaqueGeometry() VTK_OVERRIDE;
49 
56  void DeviceRenderTranslucentPolygonalGeometry() VTK_OVERRIDE;
57 
62  void ClearLights(void) VTK_OVERRIDE;
63 
64  void Clear(void) VTK_OVERRIDE;
65 
69  int UpdateLights(void) VTK_OVERRIDE;
70 
77  int GetDepthPeelingHigherLayer();
78 
80 
83  vtkGetObjectMacro(ShaderProgram, vtkShaderProgram2);
84  virtual void SetShaderProgram(vtkShaderProgram2 *program);
86 
87 protected:
89  ~vtkOpenGLRenderer() VTK_OVERRIDE;
90 
94  void CheckCompilation(unsigned int fragmentShader);
95 
96  // Internal method to release graphics resources in any derived renderers.
97  void ReleaseGraphicsResources(vtkWindow *w) VTK_OVERRIDE;
98 
99  // Picking functions to be implemented by sub-classes
100  void DevicePickRender() VTK_OVERRIDE;
101  void StartPick(unsigned int pickFromSize) VTK_OVERRIDE;
102  void UpdatePickId() VTK_OVERRIDE;
103  void DonePick() VTK_OVERRIDE;
104  unsigned int GetPickedId() VTK_OVERRIDE;
105  unsigned int GetNumPickedIds() VTK_OVERRIDE;
106  int GetPickedIds(unsigned int atMost, unsigned int *callerBuffer) VTK_OVERRIDE;
107  double GetPickedZ() VTK_OVERRIDE;
108 
109  // Ivars used in picking
110  class vtkGLPickInfo* PickInfo;
111 
112  double PickedZ;
113 
114  int NumberOfLightsBound;
121  int RenderPeel(int layer);
122 
123  friend class vtkOpenGLProperty;
124  friend class vtkOpenGLTexture;
126  friend class vtkOpenGLImageResliceMapper;
127 
132  int GetUseTextureUniformVariable();
133 
138  int GetTextureUniformVariable();
139 
144  int DepthPeelingIsSupported;
145 
150  int DepthPeelingIsSupportedChecked;
151 
155  vtkOpenGLRendererLayerList *LayerList;
156 
157  unsigned int OpaqueLayerZ;
158  unsigned int TransparentLayerZ;
159  unsigned int ProgramShader;
160 
162 
165  int ViewportX;
166  int ViewportY;
167  int ViewportWidth;
168  int ViewportHeight;
170 
175  unsigned int DepthFormat;
176 
177  // Is rendering at translucent geometry stage using depth peeling and
178  // rendering a layer other than the first one? (Boolean value)
179  // If so, the uniform variables UseTexture and Texture can be set.
180  // (Used by vtkOpenGLProperty or vtkOpenGLTexture)
181  int DepthPeelingHigherLayer;
182 
184 
185  friend class vtkRenderPass;
186 
187 private:
188  vtkOpenGLRenderer(const vtkOpenGLRenderer&) VTK_DELETE_FUNCTION;
189  void operator=(const vtkOpenGLRenderer&) VTK_DELETE_FUNCTION;
190 };
191 
192 #endif
abstract specification for renderers
Definition: vtkRenderer.h:57
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:34
GLSL Program.
virtual void DeviceRender()=0
Create an image.
a simple class to control print indentation
Definition: vtkIndent.h:33
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:55
OpenGL renderer.