VTK  9.3.20240418
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;
42 
43 class VTKRENDERINGOPENGL2_EXPORT VTK_MARSHALAUTO vtkOpenGLPolyDataMapper2D
44  : public vtkPolyDataMapper2D
45 {
46 public:
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
54  void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor) override;
55 
62 
63 protected:
66 
68 
73 
77  virtual void BuildShaders(std::string& VertexCode, std::string& fragmentCode,
78  std::string& geometryCode, vtkViewport* ren, vtkActor2D* act);
79 
83  virtual void UpdateShaders(vtkOpenGLHelper& cellBO, vtkViewport* viewport, vtkActor2D* act);
84 
88  virtual void SetCustomUniforms(vtkOpenGLHelper& cellBO, vtkActor2D* actor);
89 
94  vtkOpenGLHelper& cellBO, vtkViewport* viewport, vtkActor2D* act);
95 
100 
105 
110  virtual void ReplaceShaderPicking(std::string& fssource, vtkRenderer* ren, vtkActor2D* act);
111 
115  void UpdateVBO(vtkActor2D* act, vtkViewport* viewport);
116 
117  // The VBO and its layout.
119 
120  // Structures for the various cell types we render.
126 
131 
132  vtkTimeStamp VBOUpdateTime; // When was the VBO updated?
136 
139 
140  // do we have wide lines that require special handling
142 
143  // stores the mapping from vtk cells to gl_PrimitiveId
145 
146 private:
148  void operator=(const vtkOpenGLPolyDataMapper2D&) = delete;
149 };
150 
151 VTK_ABI_NAMESPACE_END
152 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:145
a simple class to control print indentation
Definition: vtkIndent.h:108
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:141
OpenGL buffer object.
OpenGL rendering utility functions.
2D PolyData support for OpenGL
~vtkOpenGLPolyDataMapper2D() override
virtual void BuildShaders(std::string &VertexCode, std::string &fragmentCode, std::string &geometryCode, vtkViewport *ren, vtkActor2D *act)
Build the shader source code.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetPropertyShaderParameters(vtkOpenGLHelper &cellBO, vtkViewport *viewport, vtkActor2D *act)
Set the shader parameters related to the property.
virtual void SetCustomUniforms(vtkOpenGLHelper &cellBO, vtkActor2D *actor)
Set the value of user-defined uniform variables, called by UpdateShaders.
static vtkOpenGLPolyDataMapper2D * New()
void UpdateVBO(vtkActor2D *act, vtkViewport *viewport)
Update the scene when necessary.
virtual void ReplaceShaderPicking(std::string &fssource, vtkRenderer *ren, vtkActor2D *act)
Perform string replacements on the shader templates, called from ReplaceShaderValues.
virtual void UpdateShaders(vtkOpenGLHelper &cellBO, vtkViewport *viewport, vtkActor2D *act)
Determine what shader to use and compile/link it.
vtkGenericOpenGLResourceFreeCallback * ResourceCallback
void RenderOverlay(vtkViewport *viewport, vtkActor2D *actor) override
Actually draw the poly data.
vtkNew< vtkTransform > VBOTransformInverse
virtual void SetMapperShaderParameters(vtkOpenGLHelper &cellBO, vtkViewport *viewport, vtkActor2D *act)
Set the shader parameters related to the mapper/input data, called by UpdateShaders.
vtkOpenGLBufferObject * CellScalarBuffer
void SetCameraShaderParameters(vtkOpenGLHelper &cellBO, vtkViewport *viewport, vtkActor2D *act)
Set the shader parameters related to the Camera.
vtkNew< vtkOpenGLCellToVTKCellMap > CellCellMap
vtkNew< vtkMatrix4x4 > VBOShiftScale
vtkOpenGLVertexBufferObjectGroup * VBOs
virtual bool HaveWideLines(vtkViewport *, vtkActor2D *)
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this mapper.
virtual bool GetNeedToRebuildShaders(vtkOpenGLHelper &cellBO, vtkViewport *ren, vtkActor2D *act)
Does the shader source need to be recomputed.
manage vertex buffer objects shared within a mapper
represent and manipulate 3D points
Definition: vtkPoints.h:139
draw vtkPolyData onto the image plane
abstract specification for renderers
Definition: vtkRenderer.h:172
abstracts an OpenGL texture object.
record modification and/or execution time
Definition: vtkTimeStamp.h:44
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:160
abstract specification for Viewports
Definition: vtkViewport.h:65
window superclass for vtkRenderWindow
Definition: vtkWindow.h:48
@ string
Definition: vtkX3D.h:490
#define VTK_MARSHALAUTO