VTK
vtkOpenGLPolyDataMapper2D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOpenGLPolyDataMapper2D.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 =========================================================================*/
27 #ifndef vtkOpenGLPolyDataMapper2D_h
28 #define vtkOpenGLPolyDataMapper2D_h
29 
30 #include "vtkRenderingOpenGL2Module.h" // For export macro
31 #include "vtkPolyDataMapper2D.h"
32 #include "vtkNew.h" // used for ivars
33 #include "vtkOpenGLHelper.h" // used for ivars
34 #include <string> // For API.
35 #include <vector> //for ivars
36 #include <map> //for used data arrays & vbos
37 
38 class vtkActor2D;
40 class vtkMatrix4x4;
42 class vtkOpenGLHelper;
44 class vtkPoints;
45 class vtkRenderer;
46 class vtkTextureObject;
47 class vtkTransform;
48 
49 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLPolyDataMapper2D : public vtkPolyDataMapper2D
50 {
51 public:
54  void PrintSelf(ostream& os, vtkIndent indent) override;
55 
59  void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor) override;
60 
66  void ReleaseGraphicsResources(vtkWindow *) override;
67 
68 protected:
70  ~vtkOpenGLPolyDataMapper2D() override;
71 
73 
74  // the following is all extra stuff to work around the
75  // fact that gl_PrimitiveID does not work correctly on
76  // Apple Macs with AMD graphics hardware (before macOS 10.11).
77  // See <rdar://20747550>.
79  std::vector<float> AppleBugPrimIDs;
81 
85  virtual bool GetNeedToRebuildShaders(
86  vtkOpenGLHelper &cellBO, vtkViewport *ren, vtkActor2D *act);
87 
91  virtual void BuildShaders(std::string &VertexCode,
92  std::string &fragmentCode,
93  std::string &geometryCode,
94  vtkViewport *ren, vtkActor2D *act);
95 
99  virtual void UpdateShaders(vtkOpenGLHelper &cellBO,
100  vtkViewport *viewport, vtkActor2D *act);
101 
105  virtual void SetMapperShaderParameters(vtkOpenGLHelper &cellBO, vtkViewport *ren, vtkActor2D *act);
106 
107 
111  void SetCameraShaderParameters(vtkOpenGLHelper &cellBO, vtkViewport *viewport, vtkActor2D *act);
112 
116  void SetPropertyShaderParameters(vtkOpenGLHelper &cellBO, vtkViewport *viewport, vtkActor2D *act);
117 
122  virtual void ReplaceShaderPicking(
123  std::string & fssource,
124  vtkRenderer *ren, vtkActor2D *act);
125 
129  void UpdateVBO(vtkActor2D *act, vtkViewport *viewport);
130 
131  // The VBO and its layout.
133 
134  // Structures for the various cell types we render.
140 
145 
146  vtkTimeStamp VBOUpdateTime; // When was the VBO updated?
150 
153 
154  // do we have wide lines that require special handling
155  virtual bool HaveWideLines(vtkViewport *, vtkActor2D *);
156 
157 private:
159  void operator=(const vtkOpenGLPolyDataMapper2D&) = delete;
160 };
161 
162 #endif
static vtkPolyDataMapper2D * New()
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:41
virtual void RenderOverlay(vtkViewport *, vtkActor2D *)
Definition: vtkMapper2D.h:41
abstract specification for Viewports
Definition: vtkViewport.h:47
std::vector< float > AppleBugPrimIDs
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:45
record modification and/or execution time
Definition: vtkTimeStamp.h:35
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkNew< vtkTransform > VBOTransformInverse
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
vtkNew< vtkMatrix4x4 > VBOShiftScale
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
a simple class to control print indentation
Definition: vtkIndent.h:39
abstracts an OpenGL texture object.
vtkOpenGLBufferObject * AppleBugPrimIDBuffer
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
vtkOpenGLVertexBufferObjectGroup * VBOs
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:39
vtkOpenGLBufferObject * CellScalarBuffer