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 "vtkRenderingOpenGL2Module.h" // For export macro
30 #include "vtkRenderer.h"
31 #include "vtkSmartPointer.h" // For vtkSmartPointer
32 #include <vector> // STL Header
33 #include <string> // Ivars
34 
36 class vtkRenderPass;
37 class vtkOpenGLState;
38 class vtkOpenGLTexture;
40 class vtkTextureObject;
42 class vtkShaderProgram;
43 class vtkShadowMapPass;
44 
45 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLRenderer : public vtkRenderer
46 {
47 public:
48  static vtkOpenGLRenderer *New();
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
55  void DeviceRender(void) override;
56 
60  void DeviceRenderOpaqueGeometry() override;
61 
69 
70  void Clear(void) override;
71 
75  int UpdateLights(void) override;
76 
83  int GetDepthPeelingHigherLayer();
84 
91  bool HaveApplePrimitiveIdBug();
92 
97  static bool HaveAppleQueryAllocationBug();
98 
104  bool IsDualDepthPeelingSupported();
105 
106  // Get the state object used to keep track of
107  // OpenGL state
108  vtkOpenGLState *GetState();
109 
110  // get the standard lighting uniform declarations
111  // for the current set of lights
112  const char *GetLightingUniforms();
113 
114  // update the lighting uniforms for this shader if they
115  // are out of date
116  void UpdateLightingUniforms(vtkShaderProgram *prog);
117 
118  // get the complexity of the current lights as a int
119  // 0 = no lighting
120  // 1 = headlight
121  // 2 = directional lights
122  // 3 = positional lights
124  NoLighting = 0,
125  Headlight = 1,
126  Directional = 2,
127  Positional = 3
128  };
129  vtkGetMacro(LightingComplexity, int);
130 
131  // get the number of lights turned on
132  vtkGetMacro(LightingCount, int);
133 
138  void SetUserLightTransform(vtkTransform* transform);
139 
140 protected:
142  ~vtkOpenGLRenderer() override;
143 
147  void CheckCompilation(unsigned int fragmentShader);
148 
149  // Internal method to release graphics resources in any derived renderers.
150  void ReleaseGraphicsResources(vtkWindow *w) override;
151 
157  int UpdateGeometry() override;
158 
164  vtkTexture* GetCurrentTexturedBackground();
165 
166  friend class vtkOpenGLProperty;
167  friend class vtkOpenGLTexture;
169  friend class vtkOpenGLImageResliceMapper;
170 
175 
180 
185 
190 
191  // Is rendering at translucent geometry stage using depth peeling and
192  // rendering a layer other than the first one? (Boolean value)
193  // If so, the uniform variables UseTexture and Texture can be set.
194  // (Used by vtkOpenGLProperty or vtkOpenGLTexture)
196 
197  friend class vtkRenderPass;
198 
201 
206 
211 
212 private:
213  vtkOpenGLRenderer(const vtkOpenGLRenderer&) = delete;
214  void operator=(const vtkOpenGLRenderer&) = delete;
215 };
216 
217 #endif
Implement Depth Peeling for use within a framebuffer pass.
virtual void ReleaseGraphicsResources(vtkWindow *)
vtkShadowMapPass * ShadowMapPass
Shadows are delegated to an instance of vtkShadowMapPass.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
std::string LightingDeclaration
virtual int UpdateGeometry()
Ask all props to update and draw any opaque and translucent geometry.
virtual int UpdateLights(void)
Ask all lights to load themselves into rendering pipeline.
Definition: vtkRenderer.h:887
abstract specification for renderers
Definition: vtkRenderer.h:63
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
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
vtkOpenGLFXAAFilter * FXAAFilter
FXAA is delegated to an instance of vtkOpenGLFXAAFilter.
OpenGL state storage.
virtual void DeviceRender()=0
Create an image.
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual void DeviceRenderTranslucentPolygonalGeometry()
Render translucent polygonal geometry.
vtkSmartPointer< vtkTransform > UserLightTransform
Optional user transform for lights.
handles properties associated with a texture map
Definition: vtkTexture.h:71
virtual void DeviceRenderOpaqueGeometry()
Render opaque polygonal geometry.
vtkDepthPeelingPass * DepthPeelingPass
Depth peeling is delegated to an instance of vtkDepthPeelingPass.
vtkMTimeType LightingUpdateTime
abstracts an OpenGL texture object.
vtkOrderIndependentTranslucentPass * TranslucentPass
Fallback for transparency.
static vtkRenderer * New()
Create a vtkRenderer with a black background, a white ambient light, two-sided lighting turned on...
Implement a shadow mapping render pass.
Perform FXAA antialiasing on the current framebuffer.
Perform part of the rendering of a vtkRenderer.
Definition: vtkRenderPass.h:58
OpenGL renderer.
Implement OIT rendering using average color.
virtual void Clear()
Clear the image to the background color.
Definition: vtkRenderer.h:326
The ShaderProgram uses one or more Shader objects.