VTK  9.7.1
vtkOpenGLPolyDataMapper2D.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
18 #ifndef vtkOpenGLPolyDataMapper2D_h
19 #define vtkOpenGLPolyDataMapper2D_h
20 
21 #include "vtkNew.h" // used for ivars
22 #include "vtkOpenGLHelper.h" // used for ivars
23 #include "vtkPolyDataMapper2D.h"
24 #include "vtkRenderingOpenGL2Module.h" // For export macro
25 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
26 #include <map> //for used data arrays & vbos
27 #include <string> // For API.
28 #include <vector> //for ivars
29 
30 VTK_ABI_NAMESPACE_BEGIN
31 class vtkActor2D;
33 class vtkMatrix4x4;
36 class vtkOpenGLHelper;
38 class vtkPoints;
39 class vtkRenderer;
40 class vtkTextureObject;
41 class vtkTransform;
43 
44 class VTKRENDERINGOPENGL2_EXPORT VTK_MARSHALAUTO vtkOpenGLPolyDataMapper2D
45  : public vtkPolyDataMapper2D
46 {
47 public:
50  static vtkOverrideAttribute* CreateOverrideAttributes();
52  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
57  void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor) override;
58 
64  void ReleaseGraphicsResources(vtkWindow*) override;
65 
66 protected:
68  ~vtkOpenGLPolyDataMapper2D() override;
69 
71 
75  virtual bool GetNeedToRebuildShaders(vtkOpenGLHelper& cellBO, vtkViewport* ren, vtkActor2D* act);
76 
80  virtual void BuildShaders(std::string& VertexCode, std::string& fragmentCode,
81  std::string& geometryCode, vtkViewport* ren, vtkActor2D* act);
82 
86  virtual void UpdateShaders(vtkOpenGLHelper& cellBO, vtkViewport* viewport, vtkActor2D* act);
87 
91  virtual void SetCustomUniforms(vtkOpenGLHelper& cellBO, vtkActor2D* actor);
92 
96  virtual void SetMapperShaderParameters(
97  vtkOpenGLHelper& cellBO, vtkViewport* viewport, vtkActor2D* act);
98 
102  void SetCameraShaderParameters(vtkOpenGLHelper& cellBO, vtkViewport* viewport, vtkActor2D* act);
103 
107  void SetPropertyShaderParameters(vtkOpenGLHelper& cellBO, vtkViewport* viewport, vtkActor2D* act);
108 
113  virtual void ReplaceShaderPicking(std::string& fssource, vtkRenderer* ren, vtkActor2D* act);
114 
118  void UpdateVBO(vtkActor2D* act, vtkViewport* viewport);
119 
120  // The VBO and its layout.
122 
123  // Structures for the various cell types we render.
129 
134 
135  vtkTimeStamp VBOUpdateTime; // When was the VBO updated?
139 
142 
143  // do we have wide lines that require special handling
144  virtual bool HaveWideLines(vtkViewport*, vtkActor2D*);
145 
146  // stores the mapping from vtk cells to gl_PrimitiveId
148 
149 private:
151  void operator=(const vtkOpenGLPolyDataMapper2D&) = delete;
152 };
153 
154 #define vtkOpenGLPolyDataMapper2D_OVERRIDE_ATTRIBUTES \
155  vtkOpenGLPolyDataMapper2D::CreateOverrideAttributes()
156 VTK_ABI_NAMESPACE_END
157 #endif
static vtkPolyDataMapper2D * New()
Attribute for vtkObjectFactory overrides.
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:31
vtkNew< vtkOpenGLCellToVTKCellMap > CellCellMap
virtual void RenderOverlay(vtkViewport *, vtkActor2D *)
Definition: vtkMapper2D.h:31
abstract specification for Viewports
Definition: vtkViewport.h:46
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a actor that draws 2D data
Definition: vtkActor2D.h:35
record modification and/or execution time
Definition: vtkTimeStamp.h:24
OpenGL rendering utility functions.
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkNew< vtkTransform > VBOTransformInverse
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:50
vtkNew< vtkMatrix4x4 > VBOShiftScale
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
a simple class to control print indentation
Definition: vtkIndent.h:28
#define VTK_NEWINSTANCE
abstracts an OpenGL texture object.
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
vtkOpenGLVertexBufferObjectGroup * VBOs
#define VTK_MARSHALAUTO
OpenGL buffer object.
manage vertex buffer objects shared within a mapper
2D PolyData support for OpenGL
vtkGenericOpenGLResourceFreeCallback * ResourceCallback
draw vtkPolyData onto the image plane
represent and manipulate 3D points
Definition: vtkPoints.h:30
vtkOpenGLBufferObject * CellScalarBuffer