VTK
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 "vtkRenderingOpenGL2Module.h" // For export macro
64 #include "vtkObject.h"
65 #include <map> // for methods
66 #include <vector> // for ivars
67 
68 class vtkDataArray;
72 class vtkShaderProgram;
73 class vtkViewport;
74 class vtkWindow;
75 
76 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLVertexBufferObjectGroup : public vtkObject
77 {
78 public:
81  void PrintSelf(ostream& os, vtkIndent indent) override;
82 
87  int GetNumberOfComponents(const char *attribute);
88 
93  int GetNumberOfTuples(const char *attribute);
94 
101 
106  vtkOpenGLVertexBufferObject *GetVBO(const char *attribute);
107 
112  vtkShaderProgram *program,
114 
120  void RemoveAttribute(const char *attribute);
121 
127  void CacheDataArray(const char *attribute, vtkDataArray *da,
129  int destType);
130  void CacheDataArray(const char *attribute, vtkDataArray *da,
131  vtkViewport *vp,
132  int destType);
133 
140  bool ArrayExists(const char *attribute, vtkDataArray *da,
141  vtkIdType& offset,
142  vtkIdType& totalOffset);
143 
148  void AppendDataArray(const char *attribute, vtkDataArray *da, int destType);
149 
157 
163  void ClearAllVBOs();
164 
171 
175  vtkMTimeType GetMTime() override;
176 
177 protected:
180 
181  std::map<std::string, vtkOpenGLVertexBufferObject*> UsedVBOs;
182  std::map<std::string, std::vector<vtkDataArray*> > UsedDataArrays;
183  std::map<std::string, std::map<vtkDataArray*, vtkIdType> > UsedDataArrayMaps;
184  std::map<std::string, vtkIdType> UsedDataArraySizes;
185 
186 private:
188  void operator=(const vtkOpenGLVertexBufferObjectGroup&) = delete;
189 
190 };
191 
192 #endif
vtkOpenGLVertexBufferObjectGroup::GetNumberOfComponents
int GetNumberOfComponents(const char *attribute)
Returns the number of components for this attribute zero if the attribute does not exist.
vtkOpenGLVertexBufferObjectGroup::CacheDataArray
void CacheDataArray(const char *attribute, vtkDataArray *da, vtkViewport *vp, int destType)
vtkOpenGLVertexBufferObjectGroup::GetNumberOfTuples
int GetNumberOfTuples(const char *attribute)
Returns the number of tuples for this attribute zero if the attribute does not exist.
vtkOpenGLVertexBufferObjectGroup::UsedDataArrays
std::map< std::string, std::vector< vtkDataArray * > > UsedDataArrays
Definition: vtkOpenGLVertexBufferObjectGroup.h:182
vtkOpenGLVertexBufferObjectGroup::vtkOpenGLVertexBufferObjectGroup
vtkOpenGLVertexBufferObjectGroup()
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:60
vtkOpenGLVertexBufferObjectGroup::BuildAllVBOs
void BuildAllVBOs(vtkOpenGLVertexBufferObjectCache *)
using the data arrays in this group build all the VBOs, once this has been called the reference to th...
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
vtkOpenGLVertexBufferObjectGroup::~vtkOpenGLVertexBufferObjectGroup
~vtkOpenGLVertexBufferObjectGroup() override
vtkOpenGLVertexBufferObjectGroup::BuildAllVBOs
void BuildAllVBOs(vtkViewport *)
vtkOpenGLVertexBufferObjectGroup::GetVBO
vtkOpenGLVertexBufferObject * GetVBO(const char *attribute)
Returns the VBO for an attribute, NULL if it is not present.
vtkOpenGLVertexBufferObjectGroup::RemoveAttribute
void RemoveAttribute(const char *attribute)
used to remove a no longer needed attribute Calling CacheDataArray with a nullptr attribute will also...
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
vtkOpenGLVertexBufferObjectGroup::CacheDataArray
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...
vtkOpenGLVertexBufferObjectGroup::AddAllAttributesToVAO
void AddAllAttributesToVAO(vtkShaderProgram *program, vtkOpenGLVertexArrayObject *vao)
Attach all VBOs to their attributes.
vtkOpenGLVertexBufferObjectGroup::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
vtkOpenGLVertexBufferObjectGroup::GetMTime
vtkMTimeType GetMTime() override
Get the mtime of this groups VBOs.
vtkOpenGLVertexBufferObjectGroup
manage vertex buffer objects shared within a mapper
Definition: vtkOpenGLVertexBufferObjectGroup.h:77
vtkX3D::offset
@ offset
Definition: vtkX3D.h:438
vtkShaderProgram
The ShaderProgram uses one or more Shader objects.
Definition: vtkShaderProgram.h:48
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkOpenGLVertexBufferObject
Definition: vtkOpenGLVertexBufferObject.h:40
vtkOpenGLVertexBufferObjectGroup::New
static vtkOpenGLVertexBufferObjectGroup * New()
vtkOpenGLVertexBufferObjectGroup::ArrayExists
bool ArrayExists(const char *attribute, vtkDataArray *da, vtkIdType &offset, vtkIdType &totalOffset)
Check if the array already exists.
vtkOpenGLVertexBufferObjectGroup::UsedVBOs
std::map< std::string, vtkOpenGLVertexBufferObject * > UsedVBOs
Definition: vtkOpenGLVertexBufferObjectGroup.h:181
vtkOpenGLVertexBufferObjectGroup::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:48
vtkObject.h
vtkOpenGLVertexBufferObjectGroup::UsedDataArrayMaps
std::map< std::string, std::map< vtkDataArray *, vtkIdType > > UsedDataArrayMaps
Definition: vtkOpenGLVertexBufferObjectGroup.h:183
vtkOpenGLVertexBufferObjectGroup::UsedDataArraySizes
std::map< std::string, vtkIdType > UsedDataArraySizes
Definition: vtkOpenGLVertexBufferObjectGroup.h:184
vtkOpenGLVertexBufferObjectCache
manage vertex buffer objects shared within a context
Definition: vtkOpenGLVertexBufferObjectCache.h:39
vtkOpenGLVertexBufferObjectGroup::ClearAllDataArrays
void ClearAllDataArrays()
Clear all the data arrays.
vtkOpenGLVertexBufferObjectGroup::AppendDataArray
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.
vtkOpenGLVertexArrayObject
The VertexArrayObject class uses, or emulates, vertex array objects.
Definition: vtkOpenGLVertexArrayObject.h:37
vtkOpenGLVertexBufferObjectGroup::ClearAllVBOs
void ClearAllVBOs()
Force all the VBOs to be freed from this group.
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302