VTK  9.0.1
vtkOpenGLVertexBufferObjectGroup.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOpenGLTexture.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 =========================================================================*/
60 #ifndef vtkOpenGLVertexBufferObjectGroup_h
61 #define vtkOpenGLVertexBufferObjectGroup_h
62 
63 #include "vtkObject.h"
64 #include "vtkRenderingOpenGL2Module.h" // For export macro
65 #include <map> // for methods
66 #include <string> // for ivars
67 #include <vector> // for ivars
68 
69 class vtkDataArray;
73 class vtkShaderProgram;
74 class vtkViewport;
75 class vtkWindow;
76 
77 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLVertexBufferObjectGroup : public vtkObject
78 {
79 public:
82  void PrintSelf(ostream& os, vtkIndent indent) override;
83 
88  int GetNumberOfComponents(const char* attribute);
89 
94  int GetNumberOfTuples(const char* attribute);
95 
102 
107  vtkOpenGLVertexBufferObject* GetVBO(const char* attribute);
108 
113 
119  void RemoveAttribute(const char* attribute);
120 
127  const char* attribute, vtkDataArray* da, vtkOpenGLVertexBufferObjectCache* cache, int destType);
128  void CacheDataArray(const char* attribute, vtkDataArray* da, vtkViewport* vp, int destType);
129 
137  const char* attribute, vtkDataArray* da, vtkIdType& offset, vtkIdType& totalOffset);
138 
143  void AppendDataArray(const char* attribute, vtkDataArray* da, int destType);
144 
152 
158  void ClearAllVBOs();
159 
166 
170  vtkMTimeType GetMTime() override;
171 
172 protected:
175 
176  std::map<std::string, vtkOpenGLVertexBufferObject*> UsedVBOs;
177  std::map<std::string, std::vector<vtkDataArray*> > UsedDataArrays;
178  std::map<std::string, std::map<vtkDataArray*, vtkIdType> > UsedDataArrayMaps;
179  std::map<std::string, vtkIdType> UsedDataArraySizes;
180 
181 private:
183  void operator=(const vtkOpenGLVertexBufferObjectGroup&) = delete;
184 };
185 
186 #endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:50
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract base class for most VTK objects
Definition: vtkObject.h:63
The VertexArrayObject class uses, or emulates, vertex array objects.
manage vertex buffer objects shared within a context
manage vertex buffer objects shared within a mapper
std::map< std::string, std::vector< vtkDataArray * > > UsedDataArrays
void AddAllAttributesToVAO(vtkShaderProgram *program, vtkOpenGLVertexArrayObject *vao)
Attach all VBOs to their attributes.
void ClearAllDataArrays()
Clear all the data arrays.
int GetNumberOfComponents(const char *attribute)
Returns the number of components for this attribute zero if the attribute does not exist.
void CacheDataArray(const char *attribute, vtkDataArray *da, vtkOpenGLVertexBufferObjectCache *cache, int destType)
Set the data array for an attribute in the VBO Group registers the data array until build is called o...
void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
static vtkOpenGLVertexBufferObjectGroup * New()
void CacheDataArray(const char *attribute, vtkDataArray *da, vtkViewport *vp, int destType)
std::map< std::string, vtkOpenGLVertexBufferObject * > UsedVBOs
void BuildAllVBOs(vtkViewport *)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
std::map< std::string, std::map< vtkDataArray *, vtkIdType > > UsedDataArrayMaps
std::map< std::string, vtkIdType > UsedDataArraySizes
int GetNumberOfTuples(const char *attribute)
Returns the number of tuples for this attribute zero if the attribute does not exist.
vtkOpenGLVertexBufferObject * GetVBO(const char *attribute)
Returns the VBO for an attribute, NULL if it is not present.
void AppendDataArray(const char *attribute, vtkDataArray *da, int destType)
Append a data array for an attribute in the VBO Group registers the data array until build is called.
void ClearAllVBOs()
Force all the VBOs to be freed from this group.
vtkMTimeType GetMTime() override
Get the mtime of this groups VBOs.
void BuildAllVBOs(vtkOpenGLVertexBufferObjectCache *)
using the data arrays in this group build all the VBOs, once this has been called the reference to th...
bool ArrayExists(const char *attribute, vtkDataArray *da, vtkIdType &offset, vtkIdType &totalOffset)
Check if the array already exists.
void RemoveAttribute(const char *attribute)
used to remove a no longer needed attribute Calling CacheDataArray with a nullptr attribute will also...
The ShaderProgram uses one or more Shader objects.
abstract specification for Viewports
Definition: vtkViewport.h:45
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
@ offset
Definition: vtkX3D.h:444
int vtkIdType
Definition: vtkType.h:338
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293