OpenSubdiv
Loading...
Searching...
No Matches
glVertexBuffer.h
Go to the documentation of this file.
1//
2// Copyright 2013 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://opensubdiv.org/license.
6//
7
8#ifndef OPENSUBDIV3_OSD_GL_VERTEX_BUFFER_H
9#define OPENSUBDIV3_OSD_GL_VERTEX_BUFFER_H
10
11#include "../version.h"
12
13#include <cstddef>
14
15namespace OpenSubdiv {
16namespace OPENSUBDIV_VERSION {
17
18namespace Osd {
19
27public:
28 using ID = unsigned int; // GLuint resource ID
29
31 static GLVertexBuffer * Create(int numElements, int numVertices,
32 void *deviceContext = NULL);
33
36
39 void UpdateData(const float *src, int startVertex, int numVertices,
40 void *deviceContext = NULL);
41
43 int GetNumElements() const;
44
46 int GetNumVertices() const;
47
49 ID BindVBO(void *deviceContext = NULL);
50
51protected:
53 GLVertexBuffer(int numElements, int numVertices);
54
57 bool allocate();
58
59private:
60 int _numElements;
61 int _numVertices;
62 ID _vbo;
63};
64
65} // end namespace Osd
66
67} // end namespace OPENSUBDIV_VERSION
68using namespace OPENSUBDIV_VERSION;
69
70} // end namespace OpenSubdiv
71
72#endif // OPENSUBDIV3_OSD_GL_VERTEX_BUFFER_H
Concrete vertex buffer class for GLSL subdivision and OpenGL drawing.
int GetNumElements() const
Returns how many elements defined in this vertex buffer.
void UpdateData(const float *src, int startVertex, int numVertices, void *deviceContext=NULL)
GLVertexBuffer(int numElements, int numVertices)
Constructor.
int GetNumVertices() const
Returns how many vertices allocated in this vertex buffer.
static GLVertexBuffer * Create(int numElements, int numVertices, void *deviceContext=NULL)
Creator. Returns NULL if error.
ID BindVBO(void *deviceContext=NULL)
Returns the GL buffer object.