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