VTK
vtkOpenGLIndexBufferObject.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4 
5  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
6  All rights reserved.
7  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
14 #ifndef vtkOpenGLIndexBufferObject_h
15 #define vtkOpenGLIndexBufferObject_h
16 
17 #include "vtkRenderingOpenGL2Module.h" // for export macro
18 #include "vtkOpenGLBufferObject.h"
19 
20 
28 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLIndexBufferObject :
30 {
31 public:
34  void PrintSelf(ostream& os, vtkIndent indent);
35 
36  // Sizes/offsets are all in bytes as OpenGL API expects them.
37  size_t IndexCount; // Number of indices in the VBO
38 
39  // Description:
40  // used to create an IBO for triangle primatives
41  size_t CreateTriangleIndexBuffer(vtkCellArray *cells,
42  vtkPoints *points);
43 
44  // Description:
45  // used to create an IBO for triangle primatives
46  static void AppendTriangleIndexBuffer(
47  std::vector<unsigned int> &indexArray,
48  vtkCellArray *cells,
50  vtkIdType vertexOffset);
51 
52  // Description:
53  // create a IBO for wireframe polys/tris
54  size_t CreateTriangleLineIndexBuffer(vtkCellArray *cells);
55 
56  // Description:
57  // used to create an IBO for line primatives
58  static void AppendLineIndexBuffer(
59  std::vector<unsigned int> &indexArray,
60  vtkCellArray *cells,
61  vtkIdType vertexOffset);
62 
63  // Description:
64  // create a IBO for wireframe polys/tris
65  size_t CreateLineIndexBuffer(vtkCellArray *cells);
66 
67  // Description:
68  // create a IBO for wireframe polys/tris
69  static void AppendTriangleLineIndexBuffer(
70  std::vector<unsigned int> &indexArray,
71  vtkCellArray *cells,
72  vtkIdType vertexOffset);
73 
74  // Description:
75  // used to create an IBO for primatives as points
76  size_t CreatePointIndexBuffer(vtkCellArray *cells);
77 
78  // Description:
79  // used to create an IBO for primatives as points
80  static void AppendPointIndexBuffer(
81  std::vector<unsigned int> &indexArray,
82  vtkCellArray *cells,
83  vtkIdType vertexOffset);
84 
85  // Description:
86  // used to create an IBO for line strips and triangle strips
87  size_t CreateStripIndexBuffer(
88  vtkCellArray *cells, bool wireframeTriStrips);
89 
90  static void AppendStripIndexBuffer(
91  std::vector<unsigned int> &indexArray,
92  vtkCellArray *cells,
93  vtkIdType vertexOffset, bool wireframeTriStrips);
94 
95  // Description:
96  // special index buffer for polys wireframe with edge visibilityflags
97  static void AppendEdgeFlagIndexBuffer(
98  std::vector<unsigned int> &indexArray,
99  vtkCellArray *cells,
100  vtkIdType vertexOffset, vtkDataArray *edgeflags);
101 
102  size_t CreateEdgeFlagIndexBuffer(
103  vtkCellArray *cells, vtkDataArray *edgeflags);
104 
105  // Create supporting arays that are needed when rendering cell data
106  // Some VTK cells have to be broken into smaller cells for OpenGL
107  // When we have cell data we have to map cell attributes from the VTK
108  // cell number to the actual OpenGL cell
109  // The following code fills in
110  //
111  // cellCellMap which maps a openGL cell id to the VTK cell it came from
112  //
113  static void CreateCellSupportArrays(
114  vtkCellArray *[4],
115  std::vector<unsigned int> &cellCellMap,
116  int representation,
117  vtkPoints *points);
118 
119 protected:
122 
123 private:
124  vtkOpenGLIndexBufferObject(const vtkOpenGLIndexBufferObject&) VTK_DELETE_FUNCTION;
125  void operator=(const vtkOpenGLIndexBufferObject&) VTK_DELETE_FUNCTION;
126 };
127 
128 #endif
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
int vtkIdType
Definition: vtkType.h:287
a simple class to control print indentation
Definition: vtkIndent.h:39
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
static vtkOpenGLBufferObject * New()
object to represent cell connectivity
Definition: vtkCellArray.h:50
OpenGL buffer object.
represent and manipulate 3D points
Definition: vtkPoints.h:39
OpenGL vertex buffer object.