VTK  9.0.20200807
vtkOpenGLVertexArrayObject.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 vtkOpenGLVertexArrayObject_h
15 #define vtkOpenGLVertexArrayObject_h
16 
17 #include "vtkObject.h"
18 #include "vtkRenderingOpenGL2Module.h" // for export macro
19 #include <string> // For API.
20 
21 class vtkShaderProgram;
24 
36 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLVertexArrayObject : public vtkObject
37 {
38 public:
41  void PrintSelf(ostream& os, vtkIndent indent) override;
42 
43  void Bind();
44 
45  void Release();
46 
47  void ReleaseGraphicsResources();
48 
49  void ShaderProgramChanged();
50 
52  const std::string& name, int offset, size_t stride, int elementType, int elementTupleSize,
53  bool normalize)
54  {
55  return this->AddAttributeArrayWithDivisor(
56  program, buffer, name, offset, stride, elementType, elementTupleSize, normalize, 0, false);
57  }
58 
59  bool AddAttributeArray(vtkShaderProgram* program, vtkOpenGLVertexBufferObject* buffer,
60  const std::string& name, int offset, bool normalize);
61 
62  bool AddAttributeArrayWithDivisor(vtkShaderProgram* program, vtkOpenGLBufferObject* buffer,
63  const std::string& name, int offset, size_t stride, int elementType, int elementTupleSize,
64  bool normalize, int divisor, bool isMatrix);
65 
66  bool AddAttributeMatrixWithDivisor(vtkShaderProgram* program, vtkOpenGLBufferObject* buffer,
67  const std::string& name, int offset, size_t stride, int elementType, int elementTupleSize,
68  bool normalize, int divisor, int tupleOffset);
69 
70  bool RemoveAttributeArray(const std::string& name);
71 
72  // Force this VAO to emulate a vertex array object even if
73  // the system supports VAOs. This can be useful in cases where
74  // the vertex array object does not handle all extensions.
75  void SetForceEmulation(bool val);
76 
77 protected:
79  ~vtkOpenGLVertexArrayObject() override;
80 
81 private:
83  void operator=(const vtkOpenGLVertexArrayObject&) = delete;
84  class Private;
85  Private* Internal;
86 };
87 
88 #endif // vtkOpenGLVertexArrayObject_h
vtkOpenGLBufferObject
OpenGL buffer object.
Definition: vtkOpenGLBufferObject.h:33
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkOpenGLVertexArrayObject::AddAttributeArray
bool AddAttributeArray(vtkShaderProgram *program, vtkOpenGLBufferObject *buffer, const std::string &name, int offset, size_t stride, int elementType, int elementTupleSize, bool normalize)
Definition: vtkOpenGLVertexArrayObject.h:51
vtkEventDataAction::Release
vtkX3D::offset
Definition: vtkX3D.h:444
vtkShaderProgram
The ShaderProgram uses one or more Shader objects.
Definition: vtkShaderProgram.h:44
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkOpenGLVertexBufferObject
Definition: vtkOpenGLVertexBufferObject.h:40
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkX3D::name
Definition: vtkX3D.h:225
vtkObject.h
vtkX3D::string
Definition: vtkX3D.h:496
vtkOpenGLVertexArrayObject
The VertexArrayObject class uses, or emulates, vertex array objects.
Definition: vtkOpenGLVertexArrayObject.h:36