21 #include "hx3d/graphics/buffers/attribute_array_buffer.hpp" 23 #include "hx3d/graphics/shader.hpp" 43 AttributeArrayBuffer::~AttributeArrayBuffer() {}
56 glBindBuffer(GL_ARRAY_BUFFER,
_buf);
57 glBufferData(GL_ARRAY_BUFFER,
_vector.size() *
sizeof(float),
_vector.data(), GL_STATIC_DRAW);
58 glBindBuffer(GL_ARRAY_BUFFER, 0);
67 glBindBuffer(GL_ARRAY_BUFFER,
_buf);
68 glEnableVertexAttribArray(loc);
71 glBindBuffer(GL_ARRAY_BUFFER, 0);
79 glDisableVertexAttribArray(loc);
virtual void begin(const Ptr< Shader > &shader) override
Begin the use with a shader.
void create(const Attribute attribute)
Initialize the attribute array buffer.
std::vector< float > _vector
Data.
virtual void end(const Ptr< Shader > &shader) override
End the use with a shader.
const GLenum getType() const
Get the attribute type.
Attribute specialized array buffer.
const GLuint getSize() const
Get the attribute size.
Attribute & getAttribute()
Get the attribute.
virtual void upload() override
Upload the data to the GPU.
const std::string getName() const
Get the attribute name.
Attribute _attribute
Attribute.
AttributeArrayBuffer()
Construct an empty attribute array buffer.
std::shared_ptr< T > Ptr
Quick-typing shared ptr.
OpenGL GPU uploadable buffer.