globjects  1.0.0.000000000000
Strict OpenGL objects wrapper.
VertexAttributeBinding.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include <glm/fwd.hpp>
5 
6 #include <glbinding/gl/types.h>
7 #include <glbinding/gl/boolean.h>
8 
10 
11 #include <globjects/globjects_api.h>
12 
13 
14 namespace globjects
15 {
16 
17 
18 class Buffer;
19 class VertexArray;
20 
21 class GLOBJECTS_API VertexAttributeBinding : public Referenced
22 {
23  friend class AbstractVertexAttributeBindingImplementation;
24 
25 public:
27  VertexArray * vao
28  , const gl::GLint bindingIndex);
29 
30  const VertexArray * vao() const;
31  VertexArray * vao();
32 
33  void setDivisor(gl::GLint divisor);
34 
35  void setAttribute(gl::GLint attributeIndex);
36 
37  gl::GLint attributeIndex() const;
38  gl::GLint bindingIndex() const;
39 
43  const Buffer * buffer() const;
44  void setBuffer(
45  const Buffer * vbo
46  , gl::GLint baseoffset
47  , gl::GLint stride);
48 
49  void setFormat(
50  gl::GLint size
51  , gl::GLenum type
52  , gl::GLboolean normalized = gl::GL_FALSE
53  , gl::GLuint relativeoffset = 0);
54  void setIFormat(
55  gl::GLint size
56  , gl::GLenum type
57  , gl::GLuint relativeoffset = 0);
58  void setLFormat(
59  gl::GLint size
60  , gl::GLenum type
61  , gl::GLuint relativeoffset = 0);
62 
66  void setValue(gl::GLboolean value);
67  void setValue(gl::GLbyte value);
68  void setValue(gl::GLshort value);
69  void setValue(gl::GLint value);
70  void setValue(gl::GLint64 value);
71  void setValue(gl::GLfloat value);
72  void setValue(gl::GLdouble value);
73 
74  void setValue(const glm::bvec2 & value);
75  void setValue(const glm::ivec2 & value);
76  void setValue(const glm::vec2 & value);
77  void setValue(const glm::dvec2 & value);
78 
79  void setValue(const glm::bvec3 & value);
80  void setValue(const glm::ivec3 & value);
81  void setValue(const glm::vec3 & value);
82  void setValue(const glm::dvec3 & value);
83 
84  void setValue(const glm::bvec4 & value);
85  void setValue(const glm::ivec4 & value);
86  void setValue(const glm::vec4 & value);
87  void setValue(const glm::dvec4 & value);
88 
89  void setValue(const glm::mat2 & value);
90  void setValue(const glm::mat3 & value);
91  void setValue(const glm::mat4 & value);
92  void setValue(const glm::dmat2 & value);
93  void setValue(const glm::dmat3 & value);
94  void setValue(const glm::dmat4 & value);
95 
96 protected:
97  virtual ~VertexAttributeBinding();
98 
99 protected:
100  VertexArray * m_vao; // TODO: weak_ptr?
101 
102  gl::GLint m_bindingIndex;
103  gl::GLint m_attributeIndex;
104 
105  const Buffer * m_vbo;
106 
107  mutable void * m_bindingData;
108 };
109 
110 
111 } // namespace globjects
Definition: VertexArray.h:22
Contains all the classes that wrap OpenGL functionality.
Definition: VertexAttributeBinding.h:21
gl::GLint m_attributeIndex
Definition: VertexAttributeBinding.h:103
Wrapper for OpenGL buffer objects.
Definition: Buffer.h:35
VertexArray * m_vao
Definition: VertexAttributeBinding.h:100
gl::GLint m_bindingIndex
Definition: VertexAttributeBinding.h:102
void * m_bindingData
Definition: VertexAttributeBinding.h:107
Superclass for all classes that use reference counting in globjects.
Definition: Referenced.h:22
const Buffer * m_vbo
Definition: VertexAttributeBinding.h:105