VTK  9.0.3
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 "vtkRenderer.h"
27 #include "vtkRenderingOpenGL2Module.h" // For export macro
28 #include "vtkSmartPointer.h" // For vtkSmartPointer
29 #include <string> // Ivars
30 #include <vector> // STL Header
31 
33 class vtkRenderPass;
34 class vtkOpenGLState;
35 class vtkOpenGLTexture;
37 class vtkTextureObject;
40 class vtkPBRLUTTexture;
42 class vtkShaderProgram;
43 class vtkShadowMapPass;
44 
45 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLRenderer : public vtkRenderer
46 {
47 public:
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
55  void DeviceRender(void) override;
56 
61 
69 
70  void Clear(void) override;
71 
75  int UpdateLights(void) override;
76 
84 
92 
98 
105 
106  // Get the state object used to keep track of
107  // OpenGL state
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
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  {
125  NoLighting = 0,
126  Headlight = 1,
127  Directional = 2,
128  Positional = 3
129  };
130  vtkGetMacro(LightingComplexity, int);
131 
132  // get the number of lights turned on
133  vtkGetMacro(LightingCount, int);
134 
136 
143 
145 
152 
156  void SetEnvironmentTexture(vtkTexture* texture, bool isSRGB = false) override;
157 
158  // Method to release graphics resources
160 
161 protected:
163  ~vtkOpenGLRenderer() override;
164 
168  void CheckCompilation(unsigned int fragmentShader);
169 
175  int UpdateGeometry(vtkFrameBufferObjectBase* fbo = nullptr) override;
176 
183 
184  friend class vtkOpenGLProperty;
185  friend class vtkOpenGLTexture;
187  friend class vtkOpenGLImageResliceMapper;
188 
193 
198 
203 
208 
209  // Is rendering at translucent geometry stage using depth peeling and
210  // rendering a layer other than the first one? (Boolean value)
211  // If so, the uniform variables UseTexture and Texture can be set.
212  // (Used by vtkOpenGLProperty or vtkOpenGLTexture)
214 
215  friend class vtkRenderPass;
216 
221 
226 
230 
231 private:
232  vtkOpenGLRenderer(const vtkOpenGLRenderer&) = delete;
233  void operator=(const vtkOpenGLRenderer&) = delete;
234 };
235 
236 #endif
Implement Depth Peeling for use within a framebuffer pass.
abstract interface to OpenGL FBOs
a simple class to control print indentation
Definition: vtkIndent.h:34
Perform FXAA antialiasing on the current framebuffer.
OpenGL mapper for image slice display.
OpenGL property.
OpenGL renderer.
vtkOpenGLState * GetState()
vtkPBRLUTTexture * GetEnvMapLookupTable()
Get environment textures used for image based lighting.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkPBRPrefilterTexture * EnvMapPrefiltered
void SetEnvironmentTexture(vtkTexture *texture, bool isSRGB=false) override
Overriden in order to connect the texture to the environment map textures.
vtkPBRIrradianceTexture * GetEnvMapIrradiance()
vtkShadowMapPass * ShadowMapPass
Shadows are delegated to an instance of vtkShadowMapPass.
vtkPBRIrradianceTexture * EnvMapIrradiance
std::string LightingDeclaration
vtkDepthPeelingPass * DepthPeelingPass
Depth peeling is delegated to an instance of vtkDepthPeelingPass.
vtkPBRLUTTexture * EnvMapLookupTable
static bool HaveAppleQueryAllocationBug()
Indicate if this system is subject to the apple/NVIDIA bug that causes crashes in the driver when too...
const char * GetLightingUniforms()
bool IsDualDepthPeelingSupported()
Dual depth peeling may be disabled for certain runtime configurations.
vtkTransform * GetUserLightTransform()
void Clear(void) override
Clear the image to the background color.
vtkTexture * GetCurrentTexturedBackground()
Check and return the textured background for the current state If monocular or stereo left eye,...
vtkSmartPointer< vtkTransform > UserLightTransform
Optional user transform for lights.
void DeviceRenderTranslucentPolygonalGeometry(vtkFrameBufferObjectBase *fbo=nullptr) override
Render translucent polygonal geometry.
vtkOrderIndependentTranslucentPass * TranslucentPass
Fallback for transparency.
vtkMTimeType LightingUpdateTime
int UpdateLights(void) override
Ask lights to load themselves into graphics pipeline.
static vtkOpenGLRenderer * New()
void DeviceRenderOpaqueGeometry(vtkFrameBufferObjectBase *fbo=nullptr) override
Overridden to support hidden line removal.
vtkOpenGLFXAAFilter * FXAAFilter
FXAA is delegated to an instance of vtkOpenGLFXAAFilter.
void ReleaseGraphicsResources(vtkWindow *w) override
int UpdateGeometry(vtkFrameBufferObjectBase *fbo=nullptr) override
Ask all props to update and draw any opaque and translucent geometry.
void UpdateLightingUniforms(vtkShaderProgram *prog)
void SetUserLightTransform(vtkTransform *transform)
Set the user light transform applied after the camera transform.
vtkPBRPrefilterTexture * GetEnvMapPrefiltered()
void DeviceRender(void) override
Concrete open gl render method.
bool HaveApplePrimitiveIdBug()
Indicate if this system is subject to the Apple/AMD bug of not having a working glPrimitiveId <rdar:/...
~vtkOpenGLRenderer() override
void CheckCompilation(unsigned int fragmentShader)
Check the compilation status of some fragment shader source.
int GetDepthPeelingHigherLayer()
Is rendering at translucent geometry stage using depth peeling and rendering a layer other than the f...
OpenGL state storage.
OpenGL texture map.
Implement OIT rendering using average color.
precompute irradiance texture used in physically based rendering
precompute BRDF look-up table texture used in physically based rendering
precompute prefilter texture used in physically based rendering
Perform part of the rendering of a vtkRenderer.
Definition: vtkRenderPass.h:57
abstract specification for renderers
Definition: vtkRenderer.h:59
The ShaderProgram uses one or more Shader objects.
Implement a shadow mapping render pass.
abstracts an OpenGL texture object.
handles properties associated with a texture map
Definition: vtkTexture.h:66
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:55
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
@ string
Definition: vtkX3D.h:496
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293