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 
37 class vtkActor2D;
39 class vtkMatrix4x4;
41 class vtkOpenGLHelper;
43 class vtkPoints;
44 class vtkRenderer;
45 class vtkTextureObject;
46 class vtkTransform;
47 
48 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLPolyDataMapper2D : public vtkPolyDataMapper2D
49 {
50 public:
53  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
54 
58  void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor);
59 
66 
68  vtkGetObjectMacro(VBO,vtkOpenGLVertexBufferObject);
69 
70 protected:
73 
75 
76  // the following is all extra stuff to work around the
77  // fact that gl_PrimitiveID does not work correctly on
78  // Apple devices with AMD graphics hardware. See apple
79  // bug ID 20747550
81  std::vector<float> AppleBugPrimIDs;
83 
87  virtual bool GetNeedToRebuildShaders(
88  vtkOpenGLHelper &cellBO, vtkViewport *ren, vtkActor2D *act);
89 
93  virtual void BuildShaders(std::string &VertexCode,
94  std::string &fragmentCode,
95  std::string &geometryCode,
96  vtkViewport *ren, vtkActor2D *act);
97 
101  virtual void UpdateShaders(vtkOpenGLHelper &cellBO,
102  vtkViewport *viewport, vtkActor2D *act);
103 
107  virtual void SetMapperShaderParameters(vtkOpenGLHelper &cellBO, vtkViewport *ren, vtkActor2D *act);
108 
109 
113  void SetCameraShaderParameters(vtkOpenGLHelper &cellBO, vtkViewport *viewport, vtkActor2D *act);
114 
118  void SetPropertyShaderParameters(vtkOpenGLHelper &cellBO, vtkViewport *viewport, vtkActor2D *act);
119 
124  virtual void ReplaceShaderPicking(
125  std::string & fssource,
126  vtkRenderer *ren, vtkActor2D *act);
127 
131  void UpdateVBO(vtkActor2D *act, vtkViewport *viewport);
132 
133  // The VBO and its layout.
135 
136  // Structures for the various cell types we render.
142 
147 
148  vtkTimeStamp VBOUpdateTime; // When was the VBO updated?
152 
155 
156  // do we have wide lines that require special handling
157  virtual bool HaveWideLines(vtkViewport *, vtkActor2D *);
158 
159 private:
160  vtkOpenGLPolyDataMapper2D(const vtkOpenGLPolyDataMapper2D&) VTK_DELETE_FUNCTION;
161  void operator=(const vtkOpenGLPolyDataMapper2D&) VTK_DELETE_FUNCTION;
162 };
163 
164 #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)
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
vtkOpenGLVertexBufferObject * VBO
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.
OpenGL buffer object.
2D PolyData support for OpenGL
vtkGenericOpenGLResourceFreeCallback * ResourceCallback
draw vtkPolyData onto the image plane
represent and manipulate 3D points
Definition: vtkPoints.h:39
vtkOpenGLBufferObject * CellScalarBuffer