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) VTK_OVERRIDE;
55 
59  void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor) VTK_OVERRIDE;
60 
66  void ReleaseGraphicsResources(vtkWindow *) VTK_OVERRIDE;
67 
68 protected:
70  ~vtkOpenGLPolyDataMapper2D() VTK_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 devices with AMD graphics hardware. See apple
77  // bug ID 20747550
78  bool HaveAppleBug;
79  std::vector<float> AppleBugPrimIDs;
80  vtkOpenGLBufferObject *AppleBugPrimIDBuffer;
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.
138  vtkOpenGLHelper TriStrips;
139  vtkOpenGLHelper *LastBoundBO;
140 
141  vtkTextureObject *CellScalarTexture;
142  vtkOpenGLBufferObject *CellScalarBuffer;
143  bool HaveCellScalars;
144  int PrimitiveIDOffset;
145 
146  vtkTimeStamp VBOUpdateTime; // When was the VBO updated?
147  vtkPoints *TransformedPoints;
148  vtkNew<vtkTransform> VBOTransformInverse;
149  vtkNew<vtkMatrix4x4> VBOShiftScale;
150 
151  int LastPickState;
152  vtkTimeStamp PickStateChanged;
153 
154  // do we have wide lines that require special handling
155  virtual bool HaveWideLines(vtkViewport *, vtkActor2D *);
156 
157 private:
158  vtkOpenGLPolyDataMapper2D(const vtkOpenGLPolyDataMapper2D&) VTK_DELETE_FUNCTION;
159  void operator=(const vtkOpenGLPolyDataMapper2D&) VTK_DELETE_FUNCTION;
160 };
161 
162 #endif
static vtkPolyDataMapper2D * New()
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:35
virtual void RenderOverlay(vtkViewport *, vtkActor2D *)
Definition: vtkMapper2D.h:41
abstract specification for Viewports
Definition: vtkViewport.h:44
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:39
record modification and/or execution time
Definition: vtkTimeStamp.h:32
abstract specification for renderers
Definition: vtkRenderer.h:57
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
a simple class to control print indentation
Definition: vtkIndent.h:33
abstracts an OpenGL texture object.
Allocate and hold a VTK object.
Definition: vtkNew.h:61
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
OpenGL buffer object.
manage vertex buffer objects shared within a mapper
2D PolyData support for OpenGL
draw vtkPolyData onto the image plane
represent and manipulate 3D points
Definition: vtkPoints.h:33