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) override;
42 
46  void DeviceRender(void) override;
47 
51  void DeviceRenderOpaqueGeometry() override;
52 
60 
65  void ClearLights(void) override;
66 
67  void Clear(void) override;
68 
72  int UpdateLights(void) override;
73 
80  int GetDepthPeelingHigherLayer();
81 
83 
86  vtkGetObjectMacro(ShaderProgram, vtkShaderProgram2);
87  virtual void SetShaderProgram(vtkShaderProgram2 *program);
89 
90 protected:
92  ~vtkOpenGLRenderer() 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) override;
101 
102  // Picking functions to be implemented by sub-classes
103  void DevicePickRender() override;
104  void StartPick(unsigned int pickFromSize) override;
105  void UpdatePickId() override;
106  void DonePick() override;
107  unsigned int GetPickedId() override;
108  unsigned int GetNumPickedIds() override;
109  int GetPickedIds(unsigned int atMost, unsigned int *callerBuffer) override;
110  double GetPickedZ() override;
111 
112  // Ivars used in picking
113  class vtkGLPickInfo* PickInfo;
114 
115  double PickedZ;
116 
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 
148 
154 
158  vtkOpenGLRendererLayerList *LayerList;
159 
160  unsigned int OpaqueLayerZ;
161  unsigned int TransparentLayerZ;
162  unsigned int ProgramShader;
163 
165 
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)
185 
187 
188  friend class vtkRenderPass;
189 
190 private:
191  vtkOpenGLRenderer(const vtkOpenGLRenderer&) = delete;
192  void operator=(const vtkOpenGLRenderer&) = delete;
193 };
194 
195 #endif
virtual double GetPickedZ()=0
Return the Z value for the last picked Prop.
virtual void ReleaseGraphicsResources(vtkWindow *)
virtual void ClearLights(void)
Internal method temporarily removes lights before reloading them into graphics pipeline.
Definition: vtkRenderer.h:321
virtual int UpdateLights(void)
Ask all lights to load themselves into rendering pipeline.
Definition: vtkRenderer.h:873
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.
virtual int GetPickedIds(unsigned int atMost, unsigned int *callerBuffer)=0
OpenGL property.
OpenGL mapper for image slice display.
OpenGL texture map.
virtual void UpdatePickId()=0
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
virtual void DeviceRender()=0
Create an image.
a simple class to control print indentation
Definition: vtkIndent.h:39
int ViewportWidth
Cache viewport values for depth peeling.
virtual void DeviceRenderTranslucentPolygonalGeometry()
Render translucent polygonal geometry.
int DepthPeelingIsSupportedChecked
This flag is on once the OpenGL extensions required by the depth peeling technique have been checked.
virtual void DeviceRenderOpaqueGeometry()
Render opaque polygonal geometry.
vtkOpenGLRendererLayerList * LayerList
Used by the depth peeling technique to store the transparency layers.
vtkShaderProgram2 * ShaderProgram
virtual unsigned int GetPickedId()=0
int ViewportX
Cache viewport values for depth peeling.
virtual void StartPick(unsigned int pickFromSize)=0
int ViewportHeight
Cache viewport values for depth peeling.
virtual unsigned int GetNumPickedIds()=0
int ViewportY
Cache viewport values for depth peeling.
int DepthPeelingIsSupported
This flag is on if the current OpenGL context supports extensions required by the depth peeling techn...
unsigned int OpaqueLayerZ
static vtkRenderer * New()
Create a vtkRenderer with a black background, a white ambient light, two-sided lighting turned on,...
virtual void DevicePickRender()=0
Perform part of the rendering of a vtkRenderer.
Definition: vtkRenderPass.h:58
OpenGL renderer.
class vtkGLPickInfo * PickInfo
unsigned int DepthFormat
Actual depth format: vtkgl::DEPTH_COMPONENT16_ARB or vtkgl::DEPTH_COMPONENT24_ARB.
virtual void DonePick()=0
unsigned int TransparentLayerZ
virtual void Clear()
Clear the image to the background color.
Definition: vtkRenderer.h:326
unsigned int ProgramShader