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
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:39
vtkOpenGLPolyDataMapper2D::CellScalarBuffer
vtkOpenGLBufferObject * CellScalarBuffer
Definition: vtkOpenGLPolyDataMapper2D.h:144
vtkPolyDataMapper2D
draw vtkPolyData onto the image plane
Definition: vtkPolyDataMapper2D.h:51
vtkMapper2D::RenderOverlay
virtual void RenderOverlay(vtkViewport *, vtkActor2D *)
Definition: vtkMapper2D.h:41
vtkOpenGLBufferObject
OpenGL buffer object.
Definition: vtkOpenGLBufferObject.h:32
vtkOpenGLPolyDataMapper2D::PickStateChanged
vtkTimeStamp PickStateChanged
Definition: vtkOpenGLPolyDataMapper2D.h:154
vtkOpenGLPolyDataMapper2D::LastBoundBO
vtkOpenGLHelper * LastBoundBO
Definition: vtkOpenGLPolyDataMapper2D.h:141
vtkOpenGLPolyDataMapper2D::TransformedPoints
vtkPoints * TransformedPoints
Definition: vtkOpenGLPolyDataMapper2D.h:149
vtkOpenGLPolyDataMapper2D::ResourceCallback
vtkGenericOpenGLResourceFreeCallback * ResourceCallback
Definition: vtkOpenGLPolyDataMapper2D.h:74
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkOpenGLPolyDataMapper2D::LastPickState
int LastPickState
Definition: vtkOpenGLPolyDataMapper2D.h:153
vtkOpenGLHelper.h
vtkOpenGLPolyDataMapper2D::CellScalarTexture
vtkTextureObject * CellScalarTexture
Definition: vtkOpenGLPolyDataMapper2D.h:143
vtkPolyDataMapper2D::New
static vtkPolyDataMapper2D * New()
vtkOpenGLPolyDataMapper2D::Tris
vtkOpenGLHelper Tris
Definition: vtkOpenGLPolyDataMapper2D.h:139
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkOpenGLPolyDataMapper2D::Points
vtkOpenGLHelper Points
Definition: vtkOpenGLPolyDataMapper2D.h:137
vtkPolyDataMapper2D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkGenericOpenGLResourceFreeCallback
Definition: vtkOpenGLResourceFreeCallback.h:25
vtkOpenGLHelper
Definition: vtkOpenGLHelper.h:30
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkTextureObject
abstracts an OpenGL texture object.
Definition: vtkTextureObject.h:40
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:41
vtkOpenGLPolyDataMapper2D::PrimitiveIDOffset
int PrimitiveIDOffset
Definition: vtkOpenGLPolyDataMapper2D.h:146
vtkOpenGLPolyDataMapper2D::VBOTransformInverse
vtkNew< vtkTransform > VBOTransformInverse
Definition: vtkOpenGLPolyDataMapper2D.h:150
vtkOpenGLVertexBufferObject
Definition: vtkOpenGLVertexBufferObject.h:36
vtkOpenGLPolyDataMapper2D::VBO
vtkOpenGLVertexBufferObject * VBO
Definition: vtkOpenGLPolyDataMapper2D.h:134
vtkNew< vtkTransform >
vtkOpenGLPolyDataMapper2D
2D PolyData support for OpenGL
Definition: vtkOpenGLPolyDataMapper2D.h:33
vtkAbstractMapper::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
Definition: vtkAbstractMapper.h:71
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkOpenGLPolyDataMapper2D::AppleBugPrimIDBuffer
vtkOpenGLBufferObject * AppleBugPrimIDBuffer
Definition: vtkOpenGLPolyDataMapper2D.h:82
vtkX3D::string
@ string
Definition: vtkX3D.h:490
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:45
vtkNew.h
vtkOpenGLPolyDataMapper2D::TriStrips
vtkOpenGLHelper TriStrips
Definition: vtkOpenGLPolyDataMapper2D.h:140
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkOpenGLPolyDataMapper2D::HaveAppleBug
bool HaveAppleBug
Definition: vtkOpenGLPolyDataMapper2D.h:80
vtkOpenGLPolyDataMapper2D::Lines
vtkOpenGLHelper Lines
Definition: vtkOpenGLPolyDataMapper2D.h:138
vtkOpenGLPolyDataMapper2D::HaveCellScalars
bool HaveCellScalars
Definition: vtkOpenGLPolyDataMapper2D.h:145
vtkOpenGLPolyDataMapper2D::AppleBugPrimIDs
std::vector< float > AppleBugPrimIDs
Definition: vtkOpenGLPolyDataMapper2D.h:81
vtkOpenGLPolyDataMapper2D::VBOShiftScale
vtkNew< vtkMatrix4x4 > VBOShiftScale
Definition: vtkOpenGLPolyDataMapper2D.h:151
vtkPolyDataMapper2D.h
vtkOpenGLPolyDataMapper2D::VBOUpdateTime
vtkTimeStamp VBOUpdateTime
Definition: vtkOpenGLPolyDataMapper2D.h:148