VTK  9.3.20240425
vtkOpenGLRenderer.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
123#ifndef vtkOpenGLRenderer_h
124#define vtkOpenGLRenderer_h
125
126#include "vtkRenderer.h"
127
128#include "vtkOpenGLQuadHelper.h" // for ivar
129#include "vtkRenderingOpenGL2Module.h" // For export macro
130#include "vtkSmartPointer.h" // For vtkSmartPointer
131#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
132#include <memory> // for unique_ptr
133#include <string> // Ivars
134#include <vector> // STL Header
135
136VTK_ABI_NAMESPACE_BEGIN
137class vtkFloatArray;
139class vtkRenderPass;
140class vtkOpenGLState;
141class vtkOpenGLTexture;
143class vtkTextureObject;
146class vtkPBRLUTTexture;
148class vtkShaderProgram;
149class vtkShadowMapPass;
150class vtkSSAOPass;
151class vtkPolyData;
154
155class VTKRENDERINGOPENGL2_EXPORT VTK_MARSHALAUTO vtkOpenGLRenderer : public vtkRenderer
156{
157public:
160 void PrintSelf(ostream& os, vtkIndent indent) override;
161
165 void DeviceRender() override;
166
171
179
180 void Clear() override;
181
185 int UpdateLights() override;
186
194
200
207
208 // Get the state object used to keep track of
209 // OpenGL state
211
212 // get the standard lighting uniform declarations
213 // for the current set of lights
214 const char* GetLightingUniforms();
215
216 // update the lighting uniforms for this shader if they
217 // are out of date
219
220 // get the complexity of the current lights as a int
221 // 0 = no lighting
222 // 1 = headlight
223 // 2 = directional lights
224 // 3 = positional lights
226 {
227 NoLighting = 0,
228 Headlight = 1,
229 Directional = 2,
230 Positional = 3
231 };
232 vtkGetMacro(LightingComplexity, int);
233
234 // get the number of lights turned on
235 vtkGetMacro(LightingCount, int);
236
238
245
247
254
259
261
264 vtkSetMacro(UseSphericalHarmonics, bool);
265 vtkGetMacro(UseSphericalHarmonics, bool);
266 vtkBooleanMacro(UseSphericalHarmonics, bool);
268
283 void SetEnvironmentTexture(vtkTexture* texture, bool isSRGB = false) override;
284
285 // Method to release graphics resources
287
288protected:
291
295 void CheckCompilation(unsigned int fragmentShader);
296
302 int UpdateGeometry(vtkFrameBufferObjectBase* fbo = nullptr) override;
303
310
311 friend class vtkOpenGLProperty;
312 friend class vtkOpenGLTexture;
314 friend class vtkOpenGLImageResliceMapper;
315
320
325
330
335
340
341 // Is rendering at translucent geometry stage using depth peeling and
342 // rendering a layer other than the first one? (Boolean value)
343 // If so, the uniform variables UseTexture and Texture can be set.
344 // (Used by vtkOpenGLProperty or vtkOpenGLTexture)
346
347 friend class vtkRenderPass;
348
353
358
364
369
370private:
371 vtkOpenGLRenderer(const vtkOpenGLRenderer&) = delete;
372 void operator=(const vtkOpenGLRenderer&) = delete;
373};
374
375VTK_ABI_NAMESPACE_END
376#endif
Implement Depth Peeling for use within a framebuffer pass.
dynamic, self-adjusting array of float
abstract interface to OpenGL FBOs
a simple class to control print indentation
Definition vtkIndent.h:108
Perform FXAA antialiasing on the current framebuffer.
OpenGL mapper for image slice display.
OpenGL property.
OpenGL renderer.
vtkPBRPrefilterTexture * GetEnvMapPrefiltered()
Get environment textures used for image based lighting.
vtkSmartPointer< vtkPBRIrradianceTexture > EnvMapIrradiance
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetEnvironmentTexture(vtkTexture *texture, bool isSRGB=false) override
Set/Get the environment texture used for image based lighting.
vtkSmartPointer< vtkFloatArray > SphericalHarmonics
vtkPBRLUTTexture * GetEnvMapLookupTable()
Get environment textures used for image based lighting.
vtkShadowMapPass * ShadowMapPass
Shadows are delegated to an instance of vtkShadowMapPass.
vtkOpenGLState * GetState()
std::string LightingDeclaration
vtkDepthPeelingPass * DepthPeelingPass
Depth peeling is delegated to an instance of vtkDepthPeelingPass.
static bool HaveAppleQueryAllocationBug()
Indicate if this system is subject to the apple/NVIDIA bug that causes crashes in the driver when too...
vtkSSAOPass * SSAOPass
SSAO is delegated to an instance of vtkSSAOPass.
bool IsDualDepthPeelingSupported()
Dual depth peeling may be disabled for certain runtime configurations.
vtkSmartPointer< vtkPBRLUTTexture > EnvMapLookupTable
vtkSmartPointer< vtkTransform > UserLightTransform
Optional user transform for lights.
vtkTransform * GetUserLightTransform()
Set the user light transform applied after the camera transform.
vtkSmartPointer< vtkPBRPrefilterTexture > EnvMapPrefiltered
void DeviceRenderTranslucentPolygonalGeometry(vtkFrameBufferObjectBase *fbo=nullptr) override
Render translucent polygonal geometry.
vtkTexture * GetCurrentTexturedBackground()
Check and return the textured background for the current state If monocular or stereo left eye,...
const char * GetLightingUniforms()
vtkSmartPointer< vtkTexturedActor2D > BackgroundGradientActor
int UpdateLights() override
Ask lights to load themselves into graphics pipeline.
vtkOrderIndependentTranslucentPass * TranslucentPass
Fallback for transparency.
vtkMTimeType LightingUpdateTime
void DeviceRenderOpaqueGeometry(vtkFrameBufferObjectBase *fbo=nullptr) override
Overridden to support hidden line removal.
static vtkOpenGLRenderer * New()
vtkOpenGLFXAAFilter * FXAAFilter
FXAA is delegated to an instance of vtkOpenGLFXAAFilter.
void ReleaseGraphicsResources(vtkWindow *w) override
void DeviceRender() override
Concrete open gl render method.
vtkPBRIrradianceTexture * GetEnvMapIrradiance()
Get environment textures used for image based lighting.
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.
vtkSmartPointer< vtkPolyDataMapper2D > BackgroundMapper
vtkFloatArray * GetSphericalHarmonics()
Get spherical harmonics coefficients used for irradiance.
void Clear() override
Clear the image to the background color.
vtkSmartPointer< vtkTexturedActor2D > BackgroundTextureActor
~vtkOpenGLRenderer() override
vtkSmartPointer< vtkPolyData > BackgroundQuad
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
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Perform part of the rendering of a vtkRenderer.
abstract specification for renderers
Implement a screen-space ambient occlusion pass.
Definition vtkSSAOPass.h:36
The ShaderProgram uses one or more Shader objects.
Implement a shadow mapping render pass.
Hold a reference to a vtkObjectBase instance.
abstracts an OpenGL texture object.
handles properties associated with a texture map
Definition vtkTexture.h:167
actor that draws 2D data with texture support
describes linear transformations via a 4x4 matrix
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270
#define VTK_MARSHALAUTO