HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
uniformBlock.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_IMAGING_GLF_UNIFORM_BLOCK_H
8 #define PXR_IMAGING_GLF_UNIFORM_BLOCK_H
9 
10 /// \file glf/uniformBlock.h
11 
12 #include "pxr/pxr.h"
13 #include "pxr/imaging/glf/api.h"
16 #include "pxr/base/tf/refBase.h"
17 #include "pxr/base/tf/weakBase.h"
18 #include <string>
19 
21 
22 
25 
26 /// \class GlfUniformBlock
27 ///
28 /// Manages a GL uniform buffer object.
29 ///
30 class GlfUniformBlock : public TfRefBase, public TfWeakBase {
31 public:
32 
33  /// Returns a new instance.
34  GLF_API
35  static GlfUniformBlockRefPtr New(char const *label = nullptr);
36 
37  GLF_API
38  virtual ~GlfUniformBlock();
39 
40  /// Binds the uniform buffer using a bindingMap and identifier.
41  GLF_API
42  void Bind(GlfBindingMapPtr const & bindingMap,
43  std::string const & identifier);
44 
45  /// Updates the content of the uniform buffer. If the size
46  /// is different, the buffer will be reallocated.
47  GLF_API
48  void Update(const void *data, int size);
49 
50 protected:
51  GLF_API
52  GlfUniformBlock(char const *label);
53 
54 private:
55  GLuint _buffer;
56  int _size;
57  std::string _debugLabel;
58 };
59 
60 
62 
63 #endif
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2545
GLF_API GlfUniformBlock(char const *label)
#define GLF_API
Definition: api.h:23
unsigned int GLuint
Definition: cl.hpp:167
PXR_NAMESPACE_OPEN_SCOPE TF_DECLARE_WEAK_AND_REF_PTRS(GlfUniformBlock)
static GLF_API GlfUniformBlockRefPtr New(char const *label=nullptr)
Returns a new instance.
TF_DECLARE_WEAK_PTRS(GlfBindingMap)
GLF_API void Bind(GlfBindingMapPtr const &bindingMap, std::string const &identifier)
Binds the uniform buffer using a bindingMap and identifier.
virtual GLF_API ~GlfUniformBlock()
GLsizeiptr size
Definition: glcorearb.h:664
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
GLF_API void Update(const void *data, int size)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
Definition: format.h:1821